Skip to content

Commit

Permalink
add Python 3.12 support
Browse files Browse the repository at this point in the history
  • Loading branch information
fmigneault committed Apr 25, 2024
1 parent 70f083b commit 1094d9d
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 14 deletions.
13 changes: 2 additions & 11 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
matrix:
# os: [ubuntu-latest, windows-latest]
os: [ubuntu-latest]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
allow-failure: [false]
test-case: [test-local]
# can use below option to set environment variables or makefile settings applied during test execution
Expand Down Expand Up @@ -79,18 +79,9 @@ jobs:
test-case: test-docker
# test allowed failing for legacy versions
- os: ubuntu-20.04
python-version: "3.5"
python-version: "3.7"
allow-failure: true
test-case: test-local
- os: ubuntu-20.04
python-version: "3.6"
allow-failure: true
test-case: test-local
# test allowed failing for recent versions
# - os: ubuntu-latest
# python-version: 3.12
# allow-failure: true
# test-case: test-local
steps:
- uses: actions/checkout@v2
with:
Expand Down
8 changes: 8 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ Changes
Features / Changes
~~~~~~~~~~~~~~~~~~~~~

* | Add support of Python 3.12.
|
| **NOTE**:
| Requires patch of ``authomatic.six.moves`` in ``magpie.__init__.py`` to work around vendor-specific definitions.
Fix inspiration
from `dpkp/kafka-python#2401 <https://github.com/dpkp/kafka-python/issues/2401#issuecomment-1760208950>`_.
Pending official fix (see `authomatic/authomatic#233 <https://github.com/authomatic/authomatic/issues/233>`_).
* Drop support of Python 3.5, 3.6 and 3.7. Minimum version is Python 3.8.
* Pin ``gunicorn>=22`` to address CVE-2024-1135.

Expand Down
10 changes: 10 additions & 0 deletions magpie/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

import sys

# FIXME: patch workaround for Python 3.12 issue with vendor-specific 'six.moves'
# Inspired from https://github.com/dpkp/kafka-python/issues/2401#issuecomment-1760208950
# Applied here such that anything importing 'magpie' does it first, to avoid patch everywhere importing 'authomatic'.
# Official fix required (see https://github.com/authomatic/authomatic/issues/233).
if sys.version_info >= (3, 12, 0):
import six
sys.modules["authomatic.six.moves"] = six.moves
sys.modules["authomatic.six.moves.urllib"] = six.moves.urllib
sys.modules["authomatic.six.moves.urllib.parse"] = six.moves.urllib.parse

Check warning on line 18 in magpie/__init__.py

View check run for this annotation

Codecov / codecov/patch

magpie/__init__.py#L15-L18

Added lines #L15 - L18 were not covered by tests


def includeme(config):
# import needs to be here, otherwise ImportError happens during setup.py install (modules not yet installed)
Expand Down
7 changes: 5 additions & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@ alembic>=1.10
# old variants:
# -e git+https://github.com/fmigneault/authomatic.git@httplib-port#egg=Authomatic
# https://github.com/fmigneault/authomatic/archive/httplib-port.zip#egg=Authomatic-1.0.1
# new authomatic handles openid install correctly
# leave http port until merged:
# - new authomatic handles openid install correctly
# - https://github.com/authomatic/authomatic/tree/master includes #195 (http-po#rt)
# via https://github.com/authomatic/authomatic/pull/227
# However, this is not the latest tag https://github.com/authomatic/authomatic/tree/1.2.1 (done before #227).
# - Requires https://github.com/authomatic/authomatic/issues/233 for Python 3.12 (temporary patch in magpie.__init__)
authomatic[OpenID] @ https://github.com/fmigneault/authomatic/archive/httplib-port.zip
bcrypt>=3.1.6
# FIXME: integrate when implemnted by official package (see https://github.com/bbangert/beaker/issues/201)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def _extra_requirements(base_requirements, other_requirements):
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
python_requires=">=3.8, <4",
python_requires=">=3.5, <4",

# -- Package structure -------------------------------------------------
packages=[__meta__.__package__],
Expand Down

0 comments on commit 1094d9d

Please sign in to comment.