From 9f0129091835cd441eea8a16c3a183ec76abce86 Mon Sep 17 00:00:00 2001 From: Usama Sadiq Date: Thu, 28 Mar 2024 23:10:21 +0500 Subject: [PATCH] feat: add python 311 support --- .github/workflows/ci.yml | 4 +- CHANGELOG.rst | 6 +++ help_tokens/__init__.py | 2 +- help_tokens/context_processor.py | 2 +- help_tokens/core.py | 14 ++++--- requirements/base.txt | 23 ++++++++--- requirements/ci.txt | 8 ++-- requirements/common_constraints.txt | 11 +++++- requirements/constraints.txt | 3 ++ requirements/dev.txt | 61 ++++++++++++++--------------- requirements/pip-tools.txt | 16 ++++---- requirements/pip.txt | 4 +- requirements/quality.in | 2 +- requirements/quality.txt | 45 ++++++++++----------- requirements/test.txt | 16 ++++---- setup.py | 4 +- tox.ini | 3 +- 17 files changed, 127 insertions(+), 97 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 135cfe4..30b83ac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: ['3.8'] - toxenv: [quality, django32, django42, check_keywords] + python-version: ['3.8', '3.11'] + toxenv: [quality, django42, check_keywords] steps: - uses: actions/checkout@v4 - name: setup python diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 2bacd55..40eef6e 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -11,6 +11,12 @@ Change Log .. There should always be an "Unreleased" section for changes pending release. +[2.4.0] - 2024-03-29 +==================== + +* Added support for Python 3.11 +* Dropped support for Django 3.2, Django 4.0 and Django 4.1 + [2.3.0] - 2023-08-02 ==================== diff --git a/help_tokens/__init__.py b/help_tokens/__init__.py index 38fb5e7..b2fb069 100644 --- a/help_tokens/__init__.py +++ b/help_tokens/__init__.py @@ -4,4 +4,4 @@ from .context_processor import context_processor -__version__ = '2.3.1' +__version__ = '2.4.0' diff --git a/help_tokens/context_processor.py b/help_tokens/context_processor.py index ef4dc4a..c959e7a 100644 --- a/help_tokens/context_processor.py +++ b/help_tokens/context_processor.py @@ -14,7 +14,7 @@ def _get_online_help_info(token=None): def context_processor(request): """ - The help-tokens context processor. + help-tokens context processor. The odd structure of the return is to maintain compatibility with the way edx-platform uses it. diff --git a/help_tokens/core.py b/help_tokens/core.py index 64eac63..bd5432e 100644 --- a/help_tokens/core.py +++ b/help_tokens/core.py @@ -31,15 +31,17 @@ def get_config_value(self, section_name, option, default_option="default"): """ Read a value from the configuration, with a default. - Args: - section_name (str): name of the section in the configuration from which + Args + ---- + section_name (str): Name of the section in the configuration from which the option should be found. - option (str): name of the configuration option. - default_option (str): name of the default configuration option whose + option (str): Name of the configuration option. + default_option (str): Name of the default configuration option whose value should be returned if the requested option is not found. - Returns: - str: the value from the ini file. + Returns + ------- + str: The value from the ini file. """ if self.config is None: diff --git a/requirements/base.txt b/requirements/base.txt index 04649b8..20462a1 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,9 +1,20 @@ # -# This file is autogenerated by pip-compile -# To update, run: +# This file is autogenerated by pip-compile with Python 3.8 +# by the following command: # -# pip-compile --output-file requirements/base.txt requirements/base.in +# pip-compile --output-file=requirements/base.txt requirements/base.in # -django==1.11 -pytz==2017.2 # via django -six==1.10.0 +asgiref==3.8.1 + # via django +backports-zoneinfo==0.2.1 ; python_version < "3.9" + # via + # -c requirements/constraints.txt + # django +django==4.2.11 + # via + # -c requirements/common_constraints.txt + # -r requirements/base.in +sqlparse==0.4.4 + # via django +typing-extensions==4.10.0 + # via asgiref diff --git a/requirements/ci.txt b/requirements/ci.txt index a6d254c..e8e8acc 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -16,17 +16,17 @@ codecov==2.1.13 # via -r requirements/ci.in colorama==0.4.6 # via tox -coverage==7.4.3 +coverage==7.4.4 # via codecov distlib==0.3.8 # via virtualenv -filelock==3.13.1 +filelock==3.13.3 # via # tox # virtualenv idna==3.6 # via requests -packaging==23.2 +packaging==24.0 # via # pyproject-api # tox @@ -44,7 +44,7 @@ tomli==2.0.1 # via # pyproject-api # tox -tox==4.13.0 +tox==4.14.2 # via -r requirements/ci.in urllib3==2.2.1 # via requests diff --git a/requirements/common_constraints.txt b/requirements/common_constraints.txt index 15aafb2..e3bf8ea 100644 --- a/requirements/common_constraints.txt +++ b/requirements/common_constraints.txt @@ -13,7 +13,7 @@ # using LTS django version -Django<4.0 +Django<5.0 # elasticsearch>=7.14.0 includes breaking changes in it which caused issues in discovery upgrade process. # elastic search changelog: https://www.elastic.co/guide/en/enterprise-search/master/release-notes-7.14.0.html @@ -21,3 +21,12 @@ elasticsearch<7.14.0 # django-simple-history>3.0.0 adds indexing and causes a lot of migrations to be affected django-simple-history==3.0.0 + +# opentelemetry requires version 6.x at the moment: +# https://github.com/open-telemetry/opentelemetry-python/issues/3570 +# Normally this could be added as a constraint in edx-django-utils, where we're +# adding the opentelemetry dependency. However, when we compile pip-tools.txt, +# that uses version 7.x, and then there's no undoing that when compiling base.txt. +# So we need to pin it globally, for now. +# Ticket for unpinning: https://github.com/openedx/edx-lint/issues/407 +importlib-metadata<7 diff --git a/requirements/constraints.txt b/requirements/constraints.txt index 194646a..8938893 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -10,3 +10,6 @@ # This file contains all common constraints for edx-repos -c common_constraints.txt + +# For python greater than or equal to 3.9 backports.zoneinfo causing failures +backports.zoneinfo; python_version<'3.9' diff --git a/requirements/dev.txt b/requirements/dev.txt index 0efd200..0efbe8b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,20 +4,22 @@ # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via django astroid==3.1.0 # via # pylint # pylint-celery -build==1.0.3 +backports-zoneinfo==0.2.1 ; python_version < "3.9" + # via + # -c requirements/constraints.txt + # django +build==1.2.1 # via -r requirements/quality.in cachetools==5.3.3 # via tox certifi==2024.2.2 # via requests -cffi==1.16.0 - # via cryptography chardet==5.2.0 # via # diff-cover @@ -31,19 +33,17 @@ click==8.1.7 # edx-lint click-log==0.4.0 # via edx-lint -code-annotations==1.6.0 +code-annotations==1.7.0 # via edx-lint colorama==0.4.6 # via tox -cryptography==42.0.5 - # via secretstorage diff-cover==8.0.3 # via -r requirements/dev.in dill==0.3.8 # via pylint distlib==0.3.8 # via virtualenv -django==3.2.24 +django==4.2.11 # via # -c requirements/common_constraints.txt # -r requirements/base.in @@ -56,18 +56,19 @@ edx-lint==5.3.6 # via # -r requirements/dev.in # -r requirements/quality.in -filelock==3.13.1 +filelock==3.13.3 # via # tox # virtualenv idna==3.6 # via requests -importlib-metadata==7.0.1 +importlib-metadata==6.11.0 # via + # -c requirements/common_constraints.txt # build # keyring # twine -importlib-resources==6.1.2 +importlib-resources==6.4.0 # via keyring isort==5.13.2 # via @@ -75,15 +76,15 @@ isort==5.13.2 # pylint jaraco-classes==3.3.1 # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage +jaraco-context==4.3.0 + # via keyring +jaraco-functools==4.0.0 + # via keyring jinja2==3.1.3 # via # code-annotations # diff-cover -keyring==24.3.1 +keyring==25.0.0 # via twine lxml==5.1.0 # via edx-i18n-tools @@ -96,10 +97,12 @@ mccabe==0.7.0 mdurl==0.1.2 # via markdown-it-py more-itertools==10.2.0 - # via jaraco-classes -nh3==0.2.15 + # via + # jaraco-classes + # jaraco-functools +nh3==0.2.17 # via readme-renderer -packaging==23.2 +packaging==24.0 # via # build # pyproject-api @@ -108,7 +111,7 @@ path==16.10.0 # via edx-i18n-tools pbr==6.0.0 # via stevedore -pkginfo==1.9.6 +pkginfo==1.10.0 # via twine platformdirs==4.2.0 # via @@ -123,9 +126,7 @@ polib==1.2.0 # via edx-i18n-tools pycodestyle==2.11.1 # via -r requirements/quality.in -pycparser==2.21 - # via cffi -pydocstyle==1.1.1 +pydocstyle==6.3.0 # via -r requirements/quality.in pygments==2.17.2 # via @@ -152,8 +153,6 @@ pyproject-hooks==1.0.0 # via build python-slugify==8.0.4 # via code-annotations -pytz==2024.1 - # via django pyyaml==6.0.1 # via # code-annotations @@ -168,12 +167,12 @@ requests-toolbelt==1.0.0 # via twine rfc3986==2.0.0 # via twine -rich==13.7.0 +rich==13.7.1 # via twine -secretstorage==3.3.3 - # via keyring six==1.16.0 # via edx-lint +snowballstemmer==2.2.0 + # via pydocstyle sqlparse==0.4.4 # via django stevedore==5.2.0 @@ -189,7 +188,7 @@ tomli==2.0.1 # tox tomlkit==0.12.4 # via pylint -tox==4.13.0 +tox==4.14.2 # via -r requirements/dev.in twine==5.0.0 # via @@ -207,9 +206,9 @@ urllib3==2.2.1 # twine virtualenv==20.25.1 # via tox -wheel==0.42.0 +wheel==0.43.0 # via -r requirements/dev.in -zipp==3.17.0 +zipp==3.18.1 # via # importlib-metadata # importlib-resources diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 44c48d9..6401f54 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -4,15 +4,17 @@ # # make upgrade # -build==1.0.3 +build==1.2.1 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==7.0.1 - # via build -packaging==23.2 +importlib-metadata==6.11.0 + # via + # -c requirements/common_constraints.txt + # build +packaging==24.0 # via build -pip-tools==7.4.0 +pip-tools==7.4.1 # via -r requirements/pip-tools.in pyproject-hooks==1.0.0 # via @@ -23,9 +25,9 @@ tomli==2.0.1 # build # pip-tools # pyproject-hooks -wheel==0.42.0 +wheel==0.43.0 # via pip-tools -zipp==3.17.0 +zipp==3.18.1 # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/pip.txt b/requirements/pip.txt index 6665603..cf44902 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -4,11 +4,11 @@ # # make upgrade # -wheel==0.42.0 +wheel==0.43.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: pip==24.0 # via -r requirements/pip.in -setuptools==69.1.1 +setuptools==69.2.0 # via -r requirements/pip.in diff --git a/requirements/quality.in b/requirements/quality.in index 92a763b..dad3578 100644 --- a/requirements/quality.in +++ b/requirements/quality.in @@ -5,6 +5,6 @@ edx-lint # edX pylint rules and plugins isort # to standardize order of imports pycodestyle # PEP 8 compliance validation -pydocstyle<2.0 # PEP 257 compliance validation: 2.0 doesn't know Google style, and tries to correct my grammar... :( +pydocstyle # PEP 257 compliance validation: 2.0 doesn't know Google style, and tries to correct my grammar... :( build # Build needs to be created for README validation twine # Needed to validate README.rst for usage on PyPI diff --git a/requirements/quality.txt b/requirements/quality.txt index e7c9ccd..8831895 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -8,12 +8,10 @@ astroid==3.1.0 # via # pylint # pylint-celery -build==1.0.3 +build==1.2.1 # via -r requirements/quality.in certifi==2024.2.2 # via requests -cffi==1.16.0 - # via cryptography charset-normalizer==3.3.2 # via requests click==8.1.7 @@ -23,10 +21,8 @@ click==8.1.7 # edx-lint click-log==0.4.0 # via edx-lint -code-annotations==1.6.0 +code-annotations==1.7.0 # via edx-lint -cryptography==42.0.5 - # via secretstorage dill==0.3.8 # via pylint docutils==0.20.1 @@ -35,12 +31,13 @@ edx-lint==5.3.6 # via -r requirements/quality.in idna==3.6 # via requests -importlib-metadata==7.0.1 +importlib-metadata==6.11.0 # via + # -c requirements/common_constraints.txt # build # keyring # twine -importlib-resources==6.1.2 +importlib-resources==6.4.0 # via keyring isort==5.13.2 # via @@ -48,13 +45,13 @@ isort==5.13.2 # pylint jaraco-classes==3.3.1 # via keyring -jeepney==0.8.0 - # via - # keyring - # secretstorage +jaraco-context==4.3.0 + # via keyring +jaraco-functools==4.0.0 + # via keyring jinja2==3.1.3 # via code-annotations -keyring==24.3.1 +keyring==25.0.0 # via twine markdown-it-py==3.0.0 # via rich @@ -65,22 +62,22 @@ mccabe==0.7.0 mdurl==0.1.2 # via markdown-it-py more-itertools==10.2.0 - # via jaraco-classes -nh3==0.2.15 + # via + # jaraco-classes + # jaraco-functools +nh3==0.2.17 # via readme-renderer -packaging==23.2 +packaging==24.0 # via build pbr==6.0.0 # via stevedore -pkginfo==1.9.6 +pkginfo==1.10.0 # via twine platformdirs==4.2.0 # via pylint pycodestyle==2.11.1 # via -r requirements/quality.in -pycparser==2.21 - # via cffi -pydocstyle==1.1.1 +pydocstyle==6.3.0 # via -r requirements/quality.in pygments==2.17.2 # via @@ -116,12 +113,12 @@ requests-toolbelt==1.0.0 # via twine rfc3986==2.0.0 # via twine -rich==13.7.0 +rich==13.7.1 # via twine -secretstorage==3.3.3 - # via keyring six==1.16.0 # via edx-lint +snowballstemmer==2.2.0 + # via pydocstyle stevedore==5.2.0 # via code-annotations text-unidecode==1.3 @@ -144,7 +141,7 @@ urllib3==2.2.1 # via # requests # twine -zipp==3.17.0 +zipp==3.18.1 # via # importlib-metadata # importlib-resources diff --git a/requirements/test.txt b/requirements/test.txt index 0b622da..b4005ab 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -4,9 +4,13 @@ # # make upgrade # -asgiref==3.7.2 +asgiref==3.8.1 # via django -coverage[toml]==7.4.3 +backports-zoneinfo==0.2.1 ; python_version < "3.9" + # via + # -c requirements/constraints.txt + # django +coverage[toml]==7.4.4 # via pytest-cov # via # -c requirements/common_constraints.txt @@ -18,25 +22,23 @@ exceptiongroup==1.2.0 # via pytest iniconfig==2.0.0 # via pytest -packaging==23.2 +packaging==24.0 # via pytest pluggy==1.4.0 # via pytest py==1.11.0 # via pytest-catchlog -pytest==8.0.2 +pytest==8.1.1 # via # pytest-catchlog # pytest-cov # pytest-django pytest-catchlog==1.2.2 # via -r requirements/test.in -pytest-cov==4.1.0 +pytest-cov==5.0.0 # via -r requirements/test.in pytest-django==4.8.0 # via -r requirements/test.in -pytz==2024.1 - # via django pyyaml==6.0.1 # via edx-django-release-util six==1.16.0 diff --git a/setup.py b/setup.py index 2728e32..c7e332c 100644 --- a/setup.py +++ b/setup.py @@ -119,12 +119,12 @@ def is_requirement(line): classifiers=[ 'Development Status :: 5 - Production/Stable', 'Framework :: Django', - 'Framework :: Django :: 3.2', - 'Framework :: Django :: 4.0', + 'Framework :: Django :: 4.2', 'Intended Audience :: Developers', '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', ], ) diff --git a/tox.ini b/tox.ini index a412b5a..3ff5707 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32,42}, quality +envlist = py{38, 311}-django{42}, quality, check_keywords [pycodestyle] exclude = .git,.tox,migrations @@ -16,7 +16,6 @@ norecursedirs = .* requirements [testenv] deps = - django32: Django>=3.2,<4.0 django42: Django>=4.2,<4.3 -r{toxinidir}/requirements/test.txt commands =