From e533088f7d290da7003ab450a26aa123c7a706ce Mon Sep 17 00:00:00 2001 From: Anuradha Lenka Date: Mon, 28 Sep 2026 12:22:03 +0000 Subject: [PATCH] feat: add Python 3.12 support and drop Python 3.8 - tox and CI matrix run on Python 3.11 and 3.12; bump actions/checkout to v4 and actions/setup-python to v5 - requirements bot and PyPI publish workflow use Python 3.12 - python_requires >=3.11, classifiers for 3.11 and 3.12 - Read the Docs and intersphinx on Python 3.12 - install setuptools in the quality env (setup.py is linted and 3.12 venvs no longer bundle setuptools) - constrain code-annotations<3.0.0, which requires Python >=3.12 - regenerate requirements with `make upgrade` on Python 3.12 - malformed-token tests assert DecodeError: pyjwt 2.15 raises it (the parent of InvalidSignatureError) for a corrupted signature - bump version to 0.4.0 Co-Authored-By: Claude Opus 5.5 --- .github/workflows/ci.yml | 8 +- .github/workflows/pypi-publish.yml | 6 +- .../workflows/upgrade-python-requirements.yml | 2 +- .readthedocs.yaml | 6 +- CHANGELOG.rst | 19 +++ docs/conf.py | 2 +- requirements/base.txt | 18 +-- requirements/ci.txt | 31 +++-- requirements/constraints.txt | 4 + requirements/dev.txt | 120 ++++++++++-------- requirements/doc.txt | 104 ++++++++------- requirements/pip-tools.txt | 18 +-- requirements/pip.txt | 12 +- requirements/quality.txt | 71 ++++++----- requirements/test.txt | 46 +++---- setup.py | 5 +- token_utils/__init__.py | 2 +- token_utils/tests/test_sign.py | 4 +- token_utils/tests/test_unpack.py | 4 +- tox.ini | 4 +- 20 files changed, 274 insertions(+), 212 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d9077b0..87d7bba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,13 +15,13 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11'] + python-version: ['3.11', '3.12'] toxenv: [quality, pii_check, django40] steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} @@ -37,7 +37,7 @@ jobs: run: tox - name: Run coverage - if: matrix.python-version == '3.11' && matrix.toxenv == 'django40' + if: matrix.python-version == '3.12' && matrix.toxenv == 'django40' uses: py-cov-action/python-coverage-comment-action@v3 with: GITHUB_TOKEN: ${{ github.token }} diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index ca722fa..ea81e83 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -11,11 +11,11 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: setup python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: - python-version: 3.11 + python-version: 3.12 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/.github/workflows/upgrade-python-requirements.yml b/.github/workflows/upgrade-python-requirements.yml index a7c48b9..3411ad4 100644 --- a/.github/workflows/upgrade-python-requirements.yml +++ b/.github/workflows/upgrade-python-requirements.yml @@ -15,7 +15,7 @@ jobs: uses: openedx/.github/.github/workflows/upgrade-python-requirements.yml@master with: branch: ${{ github.event.inputs.branch || 'main' }} - python_version: "3.11" + python_version: "3.12" # optional parameters below; fill in if you'd like github or email notifications # user_reviewers: "" # team_reviewers: "" diff --git a/.readthedocs.yaml b/.readthedocs.yaml index 0f029d2..c8610f8 100644 --- a/.readthedocs.yaml +++ b/.readthedocs.yaml @@ -9,7 +9,11 @@ version: 2 sphinx: configuration: docs/conf.py +build: + os: ubuntu-22.04 + tools: + python: "3.12" + python: - version: 3.8 install: - requirements: requirements/doc.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 25e39a7..00ae647 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,25 @@ Unreleased * +[0.4.0] - 2026-09-28 +************************************************ + +Added +===== + +* Added support for Python 3.12 + +Removed +======= + +* Dropped support for Python 3.8; ``python_requires`` is now ``>=3.11`` + +Changed +======= + +* Upgraded requirements, including pyjwt 2.15. A malformed token signature may now raise + ``jwt.DecodeError`` (the parent of ``InvalidSignatureError``) instead of ``InvalidSignatureError`` + [0.3.0] - 2025-06-11 ************************************************ diff --git a/docs/conf.py b/docs/conf.py index b407e5e..0478362 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -469,7 +469,7 @@ def get_version(*file_paths): # Example configuration for intersphinx: refer to the Python standard library. intersphinx_mapping = { - 'python': ('https://docs.python.org/3.8', None), + 'python': ('https://docs.python.org/3.12', None), 'django': ('https://docs.djangoproject.com/en/3.2/', 'https://docs.djangoproject.com/en/3.2/_objects/'), 'model_utils': ('https://django-model-utils.readthedocs.io/en/latest/', None), } diff --git a/requirements/base.txt b/requirements/base.txt index 6975733..42f93e1 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,22 +1,22 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.9.2 +asgiref==3.12.1 # via django -cffi==2.0.0 +cffi==2.1.1 # via cryptography -cryptography==46.0.1 +cryptography==50.0.1 # via -r requirements/base.in -django==4.2.24 +django==5.2.17 # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.in -pycparser==2.23 +pycparser==3.0 # via cffi -pyjwt==2.10.1 +pyjwt==2.15.0 # via -r requirements/base.in -sqlparse==0.5.3 +sqlparse==0.6.0 # via django diff --git a/requirements/ci.txt b/requirements/ci.txt index 6f3cfd1..96f2ba8 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1,36 +1,43 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -cachetools==6.2.0 - # via tox -chardet==5.2.0 +cachetools==7.2.0 # via tox colorama==0.4.6 # via tox -coverage==7.10.7 +coverage==7.16.2 # via -r requirements/ci.in -distlib==0.4.0 +distlib==0.4.3 # via virtualenv -filelock==3.19.1 +filelock==4.0.5 # via + # python-discovery # tox # virtualenv -packaging==25.0 +packaging==26.3 # via # pyproject-api # tox -platformdirs==4.4.0 +platformdirs==4.12.1 # via # tox # virtualenv pluggy==1.6.0 # via tox -pyproject-api==1.9.1 +pyproject-api==1.11.2 + # via tox +python-discovery==1.6.1 + # via + # tox + # virtualenv +tomli-w==1.2.0 # via tox -tox==4.30.2 +tox==4.64.4 # via -r requirements/ci.in -virtualenv==20.34.0 +typing-extensions==4.16.0 + # via tox +virtualenv==21.13.0 # via tox diff --git a/requirements/constraints.txt b/requirements/constraints.txt index d91704b..e20e8d2 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,3 +10,7 @@ # Common constraints for edx repos -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + +# 2026-09-28: code-annotations 3.0.0 requires Python >=3.12, but this library still supports 3.11. +# Remove once Python 3.11 support is dropped. +code-annotations<3.0.0 diff --git a/requirements/dev.txt b/requirements/dev.txt index 3118a1d..79f8ba7 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -1,36 +1,33 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.9.2 +asgiref==3.12.1 # via # -r requirements/quality.txt # django -astroid==3.3.11 +astroid==4.0.4 # via # -r requirements/quality.txt # pylint # pylint-celery -build==1.3.0 +build==1.6.1 # via # -r requirements/pip-tools.txt # pip-tools -cachetools==6.2.0 +cachetools==7.2.0 # via # -r requirements/ci.txt # tox -cffi==2.0.0 +cffi==2.1.1 # via # -r requirements/quality.txt # cryptography -chardet==5.2.0 - # via - # -r requirements/ci.txt - # diff-cover - # tox -click==8.3.0 +chardet==7.6.0 + # via diff-cover +click==8.5.0 # via # -r requirements/pip-tools.txt # -r requirements/quality.txt @@ -42,50 +39,52 @@ click-log==0.4.0 # via # -r requirements/quality.txt # edx-lint -code-annotations==2.3.0 +code-annotations==2.3.2 # via + # -c requirements/constraints.txt # -r requirements/quality.txt # edx-lint colorama==0.4.6 # via # -r requirements/ci.txt # tox -coverage[toml]==7.10.7 +coverage[toml]==7.16.2 # via # -r requirements/ci.txt # -r requirements/quality.txt # pytest-cov -cryptography==46.0.1 +cryptography==50.0.1 # via -r requirements/quality.txt -diff-cover==9.6.0 +diff-cover==10.6.0 # via -r requirements/dev.in -dill==0.4.0 +dill==0.4.1 # via # -r requirements/quality.txt # pylint -distlib==0.4.0 +distlib==0.4.3 # via # -r requirements/ci.txt # virtualenv -django==4.2.24 +django==5.2.17 # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/quality.txt # edx-i18n-tools -edx-i18n-tools==1.9.0 +edx-i18n-tools==2.0.0 # via -r requirements/dev.in -edx-lint==5.6.0 +edx-lint==6.2.0 # via -r requirements/quality.txt -filelock==3.19.1 +filelock==4.0.5 # via # -r requirements/ci.txt + # python-discovery # tox # virtualenv -iniconfig==2.1.0 +iniconfig==2.3.0 # via # -r requirements/quality.txt # pytest -isort==6.0.1 +isort==9.0.1 # via # -r requirements/quality.txt # pylint @@ -94,13 +93,13 @@ jinja2==3.1.6 # -r requirements/quality.txt # code-annotations # diff-cover -lxml[html-clean]==6.0.2 +lxml[html-clean]==6.1.3 # via # edx-i18n-tools # lxml-html-clean -lxml-html-clean==0.4.2 +lxml-html-clean==0.4.5 # via lxml -markupsafe==3.0.2 +markupsafe==3.0.3 # via # -r requirements/quality.txt # jinja2 @@ -108,7 +107,11 @@ mccabe==0.7.0 # via # -r requirements/quality.txt # pylint -packaging==25.0 +mypy-extensions==1.1.0 + # via + # -r requirements/quality.txt + # isort +packaging==26.3 # via # -r requirements/ci.txt # -r requirements/pip-tools.txt @@ -117,11 +120,12 @@ packaging==25.0 # pyproject-api # pytest # tox + # wheel path==16.16.0 # via edx-i18n-tools -pip-tools==7.5.0 +pip-tools==7.6.1 # via -r requirements/pip-tools.txt -platformdirs==4.4.0 +platformdirs==4.12.1 # via # -r requirements/ci.txt # -r requirements/quality.txt @@ -138,22 +142,22 @@ pluggy==1.6.0 # tox polib==1.2.0 # via edx-i18n-tools -pycodestyle==2.14.0 +pycodestyle==2.15.0 # via -r requirements/quality.txt -pycparser==2.23 +pycparser==3.0 # via # -r requirements/quality.txt # cffi pydocstyle==6.3.0 # via -r requirements/quality.txt -pygments==2.19.2 +pygments==2.21.0 # via # -r requirements/quality.txt # diff-cover # pytest -pyjwt==2.10.1 +pyjwt==2.15.0 # via -r requirements/quality.txt -pylint==3.3.8 +pylint==4.0.9 # via # -r requirements/quality.txt # edx-lint @@ -164,7 +168,7 @@ pylint-celery==0.3 # via # -r requirements/quality.txt # edx-lint -pylint-django==2.6.1 +pylint-django==2.8.0 # via # -r requirements/quality.txt # edx-lint @@ -173,29 +177,34 @@ pylint-plugin-utils==0.9.0 # -r requirements/quality.txt # pylint-celery # pylint-django -pyproject-api==1.9.1 +pyproject-api==1.11.2 # via # -r requirements/ci.txt # tox -pyproject-hooks==1.2.0 +pyproject-hooks==1.3.3 # via # -r requirements/pip-tools.txt # build # pip-tools -pytest==8.4.2 +pytest==9.1.1 # via # -r requirements/quality.txt # pytest-cov # pytest-django -pytest-cov==7.0.0 +pytest-cov==7.1.0 # via -r requirements/quality.txt -pytest-django==4.11.1 +pytest-django==4.14.0 # via -r requirements/quality.txt -python-slugify==8.0.4 +python-discovery==1.6.1 + # via + # -r requirements/ci.txt + # tox + # virtualenv +python-slugify==9.1.2 # via # -r requirements/quality.txt # code-annotations -pyyaml==6.0.2 +pyyaml==6.0.3 # via # -r requirements/quality.txt # code-annotations @@ -204,15 +213,15 @@ six==1.17.0 # via # -r requirements/quality.txt # edx-lint -snowballstemmer==3.0.1 +snowballstemmer==3.1.1 # via # -r requirements/quality.txt # pydocstyle -sqlparse==0.5.3 +sqlparse==0.6.0 # via # -r requirements/quality.txt # django -stevedore==5.5.0 +stevedore==5.9.1 # via # -r requirements/quality.txt # code-annotations @@ -220,17 +229,26 @@ text-unidecode==1.3 # via # -r requirements/quality.txt # python-slugify -tomlkit==0.13.3 +tomli-w==1.2.0 + # via + # -r requirements/ci.txt + # tox +tomlkit==0.15.1 # via # -r requirements/quality.txt + # edx-lint # pylint -tox==4.30.2 +tox==4.64.4 # via -r requirements/ci.txt -virtualenv==20.34.0 +typing-extensions==4.16.0 + # via + # -r requirements/ci.txt + # tox +virtualenv==21.13.0 # via # -r requirements/ci.txt # tox -wheel==0.45.1 +wheel==0.48.0 # via # -r requirements/pip-tools.txt # pip-tools diff --git a/requirements/doc.txt b/requirements/doc.txt index 996c591..8e84562 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -1,46 +1,46 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # alabaster==1.0.0 # via sphinx -asgiref==3.9.2 +asgiref==3.12.1 # via # -r requirements/test.txt # django -babel==2.17.0 +babel==2.18.0 # via sphinx -backports-tarfile==1.2.0 - # via jaraco-context -build==1.3.0 +build==1.6.1 # via -r requirements/doc.in -certifi==2025.8.3 +certifi==2026.7.22 # via requests -cffi==2.0.0 +cffi==2.1.1 # via # -r requirements/test.txt # cryptography -charset-normalizer==3.4.3 +charset-normalizer==3.5.1 # via requests -click==8.3.0 +click==8.5.0 # via # -r requirements/test.txt # code-annotations -code-annotations==2.3.0 - # via -r requirements/test.txt -coverage[toml]==7.10.7 +code-annotations==2.3.2 + # via + # -c requirements/constraints.txt + # -r requirements/test.txt +coverage[toml]==7.16.2 # via # -r requirements/test.txt # pytest-cov -cryptography==46.0.1 +cryptography==50.0.1 # via # -r requirements/test.txt # secretstorage -django==4.2.24 +django==5.2.17 # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/test.txt doc8==2.0.0 # via -r requirements/doc.in @@ -50,23 +50,21 @@ docutils==0.21.2 # readme-renderer # restructuredtext-lint # sphinx -id==1.5.0 +id==1.6.1 # via twine -idna==3.10 +idna==3.20 # via requests -imagesize==1.4.1 +imagesize==2.0.1 # via sphinx -importlib-metadata==8.7.0 - # via keyring -iniconfig==2.1.0 +iniconfig==2.3.0 # via # -r requirements/test.txt # pytest jaraco-classes==3.4.0 # via keyring -jaraco-context==6.0.1 +jaraco-context==6.1.2 # via keyring -jaraco-functools==4.3.0 +jaraco-functools==4.6.0 # via keyring jeepney==0.9.0 # via @@ -77,23 +75,23 @@ jinja2==3.1.6 # -r requirements/test.txt # code-annotations # sphinx -keyring==25.6.0 +keyring==25.7.0 # via twine -markdown-it-py==4.0.0 +markdown-it-py==4.2.0 # via rich -markupsafe==3.0.2 +markupsafe==3.0.3 # via # -r requirements/test.txt # jinja2 mdurl==0.1.2 # via markdown-it-py -more-itertools==10.8.0 +more-itertools==11.1.0 # via # jaraco-classes # jaraco-functools -nh3==0.3.0 +nh3==0.3.7 # via readme-renderer -packaging==25.0 +packaging==26.3 # via # -r requirements/test.txt # build @@ -105,11 +103,11 @@ pluggy==1.6.0 # -r requirements/test.txt # pytest # pytest-cov -pycparser==2.23 +pycparser==3.0 # via # -r requirements/test.txt # cffi -pygments==2.19.2 +pygments==2.21.0 # via # -r requirements/test.txt # doc8 @@ -117,50 +115,49 @@ pygments==2.19.2 # readme-renderer # rich # sphinx -pyjwt==2.10.1 +pyjwt==2.15.0 # via -r requirements/test.txt -pyproject-hooks==1.2.0 +pyproject-hooks==1.3.3 # via build -pytest==8.4.2 +pytest==9.1.1 # via # -r requirements/test.txt # pytest-cov # pytest-django -pytest-cov==7.0.0 +pytest-cov==7.1.0 # via -r requirements/test.txt -pytest-django==4.11.1 +pytest-django==4.14.0 # via -r requirements/test.txt -python-slugify==8.0.4 +python-slugify==9.1.2 # via # -r requirements/test.txt # code-annotations -pyyaml==6.0.2 +pyyaml==6.0.3 # via # -r requirements/test.txt # code-annotations -readme-renderer==44.0 +readme-renderer==46.0 # via twine -requests==2.32.5 +requests==2.34.2 # via - # id # requests-toolbelt # sphinx # twine requests-toolbelt==1.0.0 # via twine -restructuredtext-lint==1.4.0 +restructuredtext-lint==2.0.2 # via doc8 rfc3986==2.0.0 # via twine -rich==14.1.0 +rich==15.0.0 # via twine -roman-numerals-py==3.1.0 +roman-numerals==4.1.0 # via sphinx -secretstorage==3.4.0 +secretstorage==3.5.0 # via keyring -snowballstemmer==3.0.1 +snowballstemmer==3.1.1 # via sphinx -sphinx==8.2.3 +sphinx==9.1.0 # via -r requirements/doc.in sphinxcontrib-applehelp==2.0.0 # via sphinx @@ -174,11 +171,11 @@ sphinxcontrib-qthelp==2.0.0 # via sphinx sphinxcontrib-serializinghtml==2.0.0 # via sphinx -sqlparse==0.5.3 +sqlparse==0.6.0 # via # -r requirements/test.txt # django -stevedore==5.5.0 +stevedore==5.9.1 # via # -r requirements/test.txt # code-annotations @@ -187,11 +184,10 @@ text-unidecode==1.3 # via # -r requirements/test.txt # python-slugify -twine==6.2.0 +twine==7.0.0 # via -r requirements/doc.in -urllib3==2.5.0 +urllib3==2.8.0 # via + # id # requests # twine -zipp==3.23.0 - # via importlib-metadata diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index d2ab0a7..df8bedd 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -1,22 +1,24 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -build==1.3.0 +build==1.6.1 # via pip-tools -click==8.3.0 +click==8.5.0 # via pip-tools -packaging==25.0 - # via build -pip-tools==7.5.0 +packaging==26.3 + # via + # build + # wheel +pip-tools==7.6.1 # via -r requirements/pip-tools.in -pyproject-hooks==1.2.0 +pyproject-hooks==1.3.3 # via # build # pip-tools -wheel==0.45.1 +wheel==0.48.0 # via pip-tools # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index a2c36f2..78fd7a1 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,16 +1,18 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -wheel==0.45.1 +packaging==26.3 + # via wheel +wheel==0.48.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==24.2 +pip==26.2 # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/pip.in -setuptools==80.9.0 +setuptools==84.0.0 # via -r requirements/pip.in diff --git a/requirements/quality.txt b/requirements/quality.txt index d234c55..f1658ac 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -1,22 +1,22 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.9.2 +asgiref==3.12.1 # via # -r requirements/test.txt # django -astroid==3.3.11 +astroid==4.0.4 # via # pylint # pylint-celery -cffi==2.0.0 +cffi==2.1.1 # via # -r requirements/test.txt # cryptography -click==8.3.0 +click==8.5.0 # via # -r requirements/test.txt # click-log @@ -24,29 +24,30 @@ click==8.3.0 # edx-lint click-log==0.4.0 # via edx-lint -code-annotations==2.3.0 +code-annotations==2.3.2 # via + # -c requirements/constraints.txt # -r requirements/test.txt # edx-lint -coverage[toml]==7.10.7 +coverage[toml]==7.16.2 # via # -r requirements/test.txt # pytest-cov -cryptography==46.0.1 +cryptography==50.0.1 # via -r requirements/test.txt -dill==0.4.0 +dill==0.4.1 # via pylint -django==4.2.24 +django==5.2.17 # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/test.txt -edx-lint==5.6.0 +edx-lint==6.2.0 # via -r requirements/quality.in -iniconfig==2.1.0 +iniconfig==2.3.0 # via # -r requirements/test.txt # pytest -isort==6.0.1 +isort==9.0.1 # via # -r requirements/quality.in # pylint @@ -54,38 +55,40 @@ jinja2==3.1.6 # via # -r requirements/test.txt # code-annotations -markupsafe==3.0.2 +markupsafe==3.0.3 # via # -r requirements/test.txt # jinja2 mccabe==0.7.0 # via pylint -packaging==25.0 +mypy-extensions==1.1.0 + # via isort +packaging==26.3 # via # -r requirements/test.txt # pytest -platformdirs==4.4.0 +platformdirs==4.12.1 # via pylint pluggy==1.6.0 # via # -r requirements/test.txt # pytest # pytest-cov -pycodestyle==2.14.0 +pycodestyle==2.15.0 # via -r requirements/quality.in -pycparser==2.23 +pycparser==3.0 # via # -r requirements/test.txt # cffi pydocstyle==6.3.0 # via -r requirements/quality.in -pygments==2.19.2 +pygments==2.21.0 # via # -r requirements/test.txt # pytest -pyjwt==2.10.1 +pyjwt==2.15.0 # via -r requirements/test.txt -pylint==3.3.8 +pylint==4.0.9 # via # edx-lint # pylint-celery @@ -93,38 +96,38 @@ pylint==3.3.8 # pylint-plugin-utils pylint-celery==0.3 # via edx-lint -pylint-django==2.6.1 +pylint-django==2.8.0 # via edx-lint pylint-plugin-utils==0.9.0 # via # pylint-celery # pylint-django -pytest==8.4.2 +pytest==9.1.1 # via # -r requirements/test.txt # pytest-cov # pytest-django -pytest-cov==7.0.0 +pytest-cov==7.1.0 # via -r requirements/test.txt -pytest-django==4.11.1 +pytest-django==4.14.0 # via -r requirements/test.txt -python-slugify==8.0.4 +python-slugify==9.1.2 # via # -r requirements/test.txt # code-annotations -pyyaml==6.0.2 +pyyaml==6.0.3 # via # -r requirements/test.txt # code-annotations six==1.17.0 # via edx-lint -snowballstemmer==3.0.1 +snowballstemmer==3.1.1 # via pydocstyle -sqlparse==0.5.3 +sqlparse==0.6.0 # via # -r requirements/test.txt # django -stevedore==5.5.0 +stevedore==5.9.1 # via # -r requirements/test.txt # code-annotations @@ -132,5 +135,7 @@ text-unidecode==1.3 # via # -r requirements/test.txt # python-slugify -tomlkit==0.13.3 - # via pylint +tomlkit==0.15.1 + # via + # edx-lint + # pylint diff --git a/requirements/test.txt b/requirements/test.txt index db24d92..3146fea 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,65 +1,67 @@ # -# This file is autogenerated by pip-compile with Python 3.11 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # -asgiref==3.9.2 +asgiref==3.12.1 # via # -r requirements/base.txt # django -cffi==2.0.0 +cffi==2.1.1 # via # -r requirements/base.txt # cryptography -click==8.3.0 +click==8.5.0 # via code-annotations -code-annotations==2.3.0 - # via -r requirements/test.in -coverage[toml]==7.10.7 +code-annotations==2.3.2 + # via + # -c requirements/constraints.txt + # -r requirements/test.in +coverage[toml]==7.16.2 # via pytest-cov -cryptography==46.0.1 +cryptography==50.0.1 # via -r requirements/base.txt # via - # -c https:/raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt + # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.txt -iniconfig==2.1.0 +iniconfig==2.3.0 # via pytest jinja2==3.1.6 # via code-annotations -markupsafe==3.0.2 +markupsafe==3.0.3 # via jinja2 -packaging==25.0 +packaging==26.3 # via pytest pluggy==1.6.0 # via # pytest # pytest-cov -pycparser==2.23 +pycparser==3.0 # via # -r requirements/base.txt # cffi -pygments==2.19.2 +pygments==2.21.0 # via pytest -pyjwt==2.10.1 +pyjwt==2.15.0 # via -r requirements/base.txt -pytest==8.4.2 +pytest==9.1.1 # via # pytest-cov # pytest-django -pytest-cov==7.0.0 +pytest-cov==7.1.0 # via -r requirements/test.in -pytest-django==4.11.1 +pytest-django==4.14.0 # via -r requirements/test.in -python-slugify==8.0.4 +python-slugify==9.1.2 # via code-annotations -pyyaml==6.0.2 +pyyaml==6.0.3 # via code-annotations -sqlparse==0.5.3 +sqlparse==0.6.0 # via # -r requirements/base.txt # django -stevedore==5.5.0 +stevedore==5.9.1 # via code-annotations text-unidecode==1.3 # via python-slugify diff --git a/setup.py b/setup.py index fb1001b..a1fc969 100644 --- a/setup.py +++ b/setup.py @@ -145,7 +145,7 @@ def is_requirement(line): ], include_package_data=True, install_requires=load_requirements('requirements/base.in'), - python_requires=">=3.8", + python_requires=">=3.11", license="AGPL 3.0", zip_safe=False, keywords='Python edx', @@ -157,6 +157,7 @@ def is_requirement(line): 'License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+)', 'Natural Language :: English', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', ], ) diff --git a/token_utils/__init__.py b/token_utils/__init__.py index eec1cd8..99454a7 100644 --- a/token_utils/__init__.py +++ b/token_utils/__init__.py @@ -2,6 +2,6 @@ App for the creation, signing, and decoding of various access tokens. """ -__version__ = '0.3.1' +__version__ = '0.4.0' default_app_config = 'token_utils.apps.TokenUtilsConfig' # pylint: disable=invalid-name diff --git a/token_utils/tests/test_sign.py b/token_utils/tests/test_sign.py index 087ed54..d29fadf 100644 --- a/token_utils/tests/test_sign.py +++ b/token_utils/tests/test_sign.py @@ -4,7 +4,7 @@ import unittest from time import time -from jwt.exceptions import InvalidSignatureError +from jwt.exceptions import DecodeError from token_utils import api from token_utils.sign import create_jwt @@ -46,7 +46,7 @@ def test_malformed_token(self): expected_token_with_claims = expected_full_token.copy() expected_token_with_claims.update(test_claims) - with self.assertRaises(InvalidSignatureError): + with self.assertRaises(DecodeError): unpack_and_verify(token) def test_sign_api_hooked_up(self): diff --git a/token_utils/tests/test_unpack.py b/token_utils/tests/test_unpack.py index 4c12ca2..72d81b3 100644 --- a/token_utils/tests/test_unpack.py +++ b/token_utils/tests/test_unpack.py @@ -6,7 +6,7 @@ from time import time from unittest.mock import patch -from jwt.exceptions import ExpiredSignatureError, InvalidSignatureError, MissingRequiredClaimError +from jwt.exceptions import DecodeError, ExpiredSignatureError, InvalidSignatureError, MissingRequiredClaimError from token_utils import api from token_utils.sign import _encode_and_sign, create_jwt @@ -50,7 +50,7 @@ def test_malformed_token(self): expected_token_with_claims = expected_full_token.copy() expected_token_with_claims.update(test_claims) - with self.assertRaises(InvalidSignatureError): + with self.assertRaises(DecodeError): unpack_jwt(token, test_user_id, test_now) @patch('token_utils.api.unpack_jwt') diff --git a/tox.ini b/tox.ini index 9aa9d9c..5e7255b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py311-django{40} +envlist = py{311,312}-django{40} [doc8] ; D001 = Line too long @@ -69,6 +69,8 @@ allowlist_externals = touch deps = -r{toxinidir}/requirements/quality.txt + # setup.py is linted by pylint; Python 3.12 venvs no longer bundle setuptools + setuptools commands = touch tests/__init__.py pylint token_utils tests test_utils manage.py setup.py