From 524890196bfbdd9313861735fae6f315f5541d63 Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Wed, 21 Feb 2024 13:13:32 +0500 Subject: [PATCH 1/5] feat: add support for python 3.12 --- .github/workflows/ci.yml | 5 +++-- CHANGELOG.rst | 1 + edx_when/__init__.py | 2 +- edx_when/models.py | 2 +- setup.py | 3 +-- tox.ini | 13 +++++++------ 6 files changed, 14 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf1f995..f1dac4e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,11 @@ jobs: name: Tests runs-on: ${{ matrix.os }} strategy: + fail-fast: false matrix: os: [ubuntu-20.04] - python-version: ['3.8'] - toxenv: [quality, docs, pii_check, django32, django40, django42] + python-version: ['3.8', '3.12'] + toxenv: [quality, docs, pii_check, django42] steps: - uses: actions/checkout@v2 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index d8a322b..80b9d46 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -16,6 +16,7 @@ Unreleased * Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is deprecated +* Add support for Python 3.12 [2.4.0] - 2023-06-21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/edx_when/__init__.py b/edx_when/__init__.py index 1e688a5..8df0d58 100644 --- a/edx_when/__init__.py +++ b/edx_when/__init__.py @@ -2,4 +2,4 @@ Central source of course block dates for the LMS. """ -__version__ = '2.4.0' +__version__ = '2.5.0' diff --git a/edx_when/models.py b/edx_when/models.py index e540bdf..713fe38 100644 --- a/edx_when/models.py +++ b/edx_when/models.py @@ -157,7 +157,7 @@ def clean(self): schedule = get_schedule_for_user(self.user.id, self.content_date.course_id) # pylint: disable=no-member policy_date = self.content_date.policy.actual_date(schedule=schedule) - if self.rel_date is not None and self.rel_date.total_seconds() < 0: + if self.rel_date is not None and self.rel_date.total_seconds() < 0: # pylint: disable=no-member raise ValidationError(_("Override date must be later than policy date")) if self.abs_date is not None and isinstance(policy_date, datetime) and self.abs_date < policy_date: raise ValidationError(_("Override date must be later than policy date")) diff --git a/setup.py b/setup.py index 5cc223a..e4f7029 100644 --- a/setup.py +++ b/setup.py @@ -123,14 +123,13 @@ def is_requirement(line): classifiers=[ 'Development Status :: 3 - Alpha', '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.12', ], entry_points={ 'lms.djangoapp': [ diff --git a/tox.ini b/tox.ini index 5627120..62cd23b 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38-django{32,40,42}, pii_check, quality, docs +envlist = py{38,312}-django{42}, pii_check, quality, docs [doc8] max-line-length = 120 @@ -18,10 +18,9 @@ addopts = --cov edx_when --cov-report term-missing --cov-report xml norecursedirs = .* docs requirements [testenv] -deps = - django32: Django>=3.2,<4.0 - django40: Django>=4.0,<4.1 - django42: Django>=4.2,<4.3 +deps = + wheel + django42: Django>=4.2,<5.0 -r{toxinidir}/requirements/test.txt commands = python -Wd -m pytest {posargs} @@ -35,6 +34,7 @@ allowlist_externals = rm twine deps = + wheel -r{toxinidir}/requirements/doc.txt commands = doc8 --ignore-path docs/_build README.rst docs @@ -54,6 +54,7 @@ allowlist_externals = rm touch deps = + wheel -r{toxinidir}/requirements/quality.txt commands = touch tests/__init__.py @@ -69,7 +70,7 @@ setenv = DJANGO_SETTINGS_MODULE = test_settings deps = -r{toxinidir}/requirements/test.txt - django32: Django>=3.2,<4.0 + django42: Django>=4.2,<5.0 commands = code_annotations django_find_annotations --config_file .pii_annotations.yml --lint --report --coverage From c14cc415f7e2d03323f7b03c0447139941d97d7e Mon Sep 17 00:00:00 2001 From: Irtaza Akram Date: Mon, 26 Feb 2024 11:53:25 +0500 Subject: [PATCH 2/5] fix: tests --- tests/test_xblock_services.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_xblock_services.py b/tests/test_xblock_services.py index 43cbbc4..f8adced 100644 --- a/tests/test_xblock_services.py +++ b/tests/test_xblock_services.py @@ -68,8 +68,8 @@ def test_field_data_get(self): assert date == self.items[0][1]['due'] # non-date - dfd.get(block, b'foo') - assert defaults.get.called_once_with(block.location, 'foo') + dfd.get(block, 'foo') + defaults.get.assert_called_once_with(block, 'foo') # non-existent value defaults.has.return_value = False @@ -100,9 +100,9 @@ def test_field_data_set_delete(self): defaults = mock.MagicMock() dfd = field_data.DateLookupFieldData(defaults, course_id=self.course_id, use_cached=False, user=self.user) dfd.set('foo', 'bar', 'x') - assert defaults.called_once_with('foo', 'bar', 'x') + defaults.set.assert_called_once_with('foo', 'bar', 'x') dfd.delete('baz', 'boing') - assert defaults.called_once_with('baz', 'boing') + defaults.delete.assert_called_once_with('baz', 'boing') def test_wrapped_fielddata(self): defaults = mock.MagicMock() @@ -122,7 +122,7 @@ def test_name(self): def test_collect(self): block_structure = mock.MagicMock() field_data.DateOverrideTransformer.collect(block_structure) - assert block_structure.request_xblock_fields.called_once_with('due', 'start') + block_structure.request_xblock_fields.assert_called_once_with('due', 'start', 'end') @mock.patch('edx_when.api._are_relative_dates_enabled', return_value=True) def test_transform(self, _mock): From 217df75ef6d7fb3684b9c45459a3d6427a39e215 Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Wed, 3 Apr 2024 00:57:47 +0500 Subject: [PATCH 3/5] feat: adding python3.11 support. --- .github/workflows/ci.yml | 2 +- CHANGELOG.rst | 4 +++- setup.py | 2 +- tox.ini | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f1dac4e..2b8a2a4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,7 +15,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04] - python-version: ['3.8', '3.12'] + python-version: ['3.8', '3.11'] toxenv: [quality, docs, pii_check, django42] steps: diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 80b9d46..7bfcd1b 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -14,9 +14,11 @@ Change Log Unreleased ~~~~~~~~~~ +[2.5.0] - 2024-04-02 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +* Add support for Python 3.11. Dropped django32 support. * Switch from ``edx-sphinx-theme`` to ``sphinx-book-theme`` since the former is deprecated -* Add support for Python 3.12 [2.4.0] - 2023-06-21 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/setup.py b/setup.py index e4f7029..293deaa 100644 --- a/setup.py +++ b/setup.py @@ -129,7 +129,7 @@ def is_requirement(line): 'Natural Language :: English', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.8', - 'Programming Language :: Python :: 3.12', + 'Programming Language :: Python :: 3.11', ], entry_points={ 'lms.djangoapp': [ diff --git a/tox.ini b/tox.ini index 62cd23b..07882e0 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,312}-django{42}, pii_check, quality, docs +envlist = py{38,311}-django{42}, pii_check, quality, docs [doc8] max-line-length = 120 From 7460732453c41bad8d72bdef2d6751f14dea27ca Mon Sep 17 00:00:00 2001 From: awais qureshi Date: Wed, 3 Apr 2024 01:01:37 +0500 Subject: [PATCH 4/5] feat: adding python3.11 support. --- requirements/constraints.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/requirements/constraints.txt b/requirements/constraints.txt index a332cf7..2166bc8 100644 --- a/requirements/constraints.txt +++ b/requirements/constraints.txt @@ -16,3 +16,6 @@ # but diff-cover latest has a pin (pluggy<1.0.0a1) # Using the same version of diff-cover which is being used currently in edx-platform to avoid this conflict. diff-cover==4.0.0 + +# Temporary pin. +backports-zoneinfo==0.2.1;python_version < "3.9" \ No newline at end of file From aeed395b9892e6bf3278f27a8dabff57719f367b Mon Sep 17 00:00:00 2001 From: edX requirements bot Date: Tue, 2 Apr 2024 16:03:11 -0400 Subject: [PATCH 5/5] chore: Updating Python Requirements --- requirements/base.txt | 17 +++++++++-------- requirements/dev.txt | 36 +++++++++++++++++------------------- requirements/doc.txt | 21 +++++++++++---------- requirements/pip-tools.txt | 2 +- requirements/quality.txt | 17 +++++++++-------- requirements/test.txt | 17 +++++++++-------- 6 files changed, 56 insertions(+), 54 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index bf36bfb..2b067ff 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -8,8 +8,9 @@ appdirs==1.4.4 # via fs asgiref==3.8.1 # via django -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # django # djangorestframework certifi==2024.2.2 @@ -37,7 +38,7 @@ django==4.2.11 # edx-drf-extensions django-crum==0.7.9 # via edx-django-utils -django-model-utils==4.4.0 +django-model-utils==4.5.0 # via -r requirements/base.in django-waffle==4.1.0 # via @@ -49,11 +50,11 @@ djangorestframework==3.15.1 # edx-drf-extensions drf-jwt==1.19.2 # via edx-drf-extensions -edx-django-utils==5.11.0 +edx-django-utils==5.12.0 # via # -r requirements/base.in # edx-drf-extensions -edx-drf-extensions==10.2.0 +edx-drf-extensions==10.3.0 # via -r requirements/base.in edx-opaque-keys==2.5.1 # via @@ -63,7 +64,7 @@ fs==2.4.16 # via xblock idna==3.6 # via requests -lxml==5.1.0 +lxml==5.2.1 # via xblock mako==1.3.2 # via xblock @@ -71,13 +72,13 @@ markupsafe==2.1.5 # via # mako # xblock -newrelic==9.7.1 +newrelic==9.8.0 # via edx-django-utils pbr==6.0.0 # via stevedore psutil==5.9.8 # via edx-django-utils -pycparser==2.21 +pycparser==2.22 # via cffi pyjwt[crypto]==2.8.0 # via @@ -115,7 +116,7 @@ typing-extensions==4.10.0 # edx-opaque-keys urllib3==2.2.1 # via requests -web-fragments==2.1.0 +web-fragments==2.2.0 # via xblock webob==1.8.7 # via xblock diff --git a/requirements/dev.txt b/requirements/dev.txt index 4b51f10..98360a4 100644 --- a/requirements/dev.txt +++ b/requirements/dev.txt @@ -4,8 +4,6 @@ # # make upgrade # -annotated-types==0.6.0 - # via pydantic appdirs==1.4.4 # via # -r requirements/quality.txt @@ -19,12 +17,13 @@ astroid==3.1.0 # -r requirements/quality.txt # pylint # pylint-celery -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # -r requirements/quality.txt # django # djangorestframework -build==1.1.1 +build==1.2.1 # via # -r requirements/pip-tools.txt # pip-tools @@ -92,7 +91,7 @@ django-crum==0.7.9 # via # -r requirements/quality.txt # edx-django-utils -django-model-utils==4.4.0 +django-model-utils==4.5.0 # via -r requirements/quality.txt django-waffle==4.1.0 # via @@ -108,11 +107,11 @@ drf-jwt==1.19.2 # via # -r requirements/quality.txt # edx-drf-extensions -edx-django-utils==5.11.0 +edx-django-utils==5.12.0 # via # -r requirements/quality.txt # edx-drf-extensions -edx-drf-extensions==10.2.0 +edx-drf-extensions==10.3.0 # via -r requirements/quality.txt edx-i18n-tools==1.3.0 # via -r requirements/dev.in @@ -140,7 +139,8 @@ importlib-metadata==6.11.0 # -r requirements/pip-tools.txt # build # path-py -inflect==7.0.0 + # typeguard +inflect==7.2.0 # via jinja2-pluralize iniconfig==2.0.0 # via @@ -158,7 +158,7 @@ jinja2==3.1.3 # jinja2-pluralize jinja2-pluralize==0.3.0 # via diff-cover -lxml==5.1.0 +lxml==5.2.1 # via # -r requirements/quality.txt # edx-i18n-tools @@ -179,7 +179,9 @@ mccabe==0.7.0 # pylint mock==5.1.0 # via -r requirements/quality.txt -newrelic==9.7.1 +more-itertools==10.2.0 + # via inflect +newrelic==9.8.0 # via # -r requirements/quality.txt # edx-django-utils @@ -216,14 +218,10 @@ psutil==5.9.8 # edx-django-utils pycodestyle==2.11.1 # via -r requirements/quality.txt -pycparser==2.21 +pycparser==2.22 # via # -r requirements/quality.txt # cffi -pydantic==2.6.4 - # via inflect -pydantic-core==2.16.3 - # via pydantic pydocstyle==6.3.0 # via -r requirements/quality.txt pygments==2.17.2 @@ -343,22 +341,22 @@ tomlkit==0.12.4 # via # -r requirements/quality.txt # pylint +typeguard==4.2.1 + # via inflect typing-extensions==4.10.0 # via # -r requirements/quality.txt - # annotated-types # asgiref # astroid # edx-opaque-keys # inflect - # pydantic - # pydantic-core # pylint + # typeguard urllib3==2.2.1 # via # -r requirements/quality.txt # requests -web-fragments==2.1.0 +web-fragments==2.2.0 # via # -r requirements/quality.txt # xblock diff --git a/requirements/doc.txt b/requirements/doc.txt index 70be9a8..230952d 100644 --- a/requirements/doc.txt +++ b/requirements/doc.txt @@ -20,8 +20,9 @@ babel==2.14.0 # via # pydata-sphinx-theme # sphinx -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # -r requirements/test.txt # django # djangorestframework @@ -73,7 +74,7 @@ django-crum==0.7.9 # via # -r requirements/test.txt # edx-django-utils -django-model-utils==4.4.0 +django-model-utils==4.5.0 # via -r requirements/test.txt django-waffle==4.1.0 # via @@ -98,11 +99,11 @@ drf-jwt==1.19.2 # via # -r requirements/test.txt # edx-drf-extensions -edx-django-utils==5.11.0 +edx-django-utils==5.12.0 # via # -r requirements/test.txt # edx-drf-extensions -edx-drf-extensions==10.2.0 +edx-drf-extensions==10.3.0 # via -r requirements/test.txt edx-opaque-keys==2.5.1 # via @@ -134,7 +135,7 @@ iniconfig==2.0.0 # via # -r requirements/test.txt # pytest -jaraco-classes==3.3.1 +jaraco-classes==3.4.0 # via keyring jaraco-context==4.3.0 # via keyring @@ -149,9 +150,9 @@ jinja2==3.1.3 # -r requirements/test.txt # code-annotations # sphinx -keyring==25.0.0 +keyring==25.1.0 # via twine -lxml==5.1.0 +lxml==5.2.1 # via # -r requirements/test.txt # xblock @@ -175,7 +176,7 @@ more-itertools==10.2.0 # via # jaraco-classes # jaraco-functools -newrelic==9.7.1 +newrelic==9.8.0 # via # -r requirements/test.txt # edx-django-utils @@ -201,7 +202,7 @@ psutil==5.9.8 # via # -r requirements/test.txt # edx-django-utils -pycparser==2.21 +pycparser==2.22 # via # -r requirements/test.txt # cffi @@ -345,7 +346,7 @@ urllib3==2.2.1 # -r requirements/test.txt # requests # twine -web-fragments==2.1.0 +web-fragments==2.2.0 # via # -r requirements/test.txt # xblock diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index b1ac4e5..6401f54 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.txt @@ -4,7 +4,7 @@ # # make upgrade # -build==1.1.1 +build==1.2.1 # via pip-tools click==8.1.7 # via pip-tools diff --git a/requirements/quality.txt b/requirements/quality.txt index 8355cd8..9fb12a8 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -16,8 +16,9 @@ astroid==3.1.0 # via # pylint # pylint-celery -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # -r requirements/test.txt # django # djangorestframework @@ -74,7 +75,7 @@ django-crum==0.7.9 # via # -r requirements/test.txt # edx-django-utils -django-model-utils==4.4.0 +django-model-utils==4.5.0 # via -r requirements/test.txt django-waffle==4.1.0 # via @@ -90,11 +91,11 @@ drf-jwt==1.19.2 # via # -r requirements/test.txt # edx-drf-extensions -edx-django-utils==5.11.0 +edx-django-utils==5.12.0 # via # -r requirements/test.txt # edx-drf-extensions -edx-drf-extensions==10.2.0 +edx-drf-extensions==10.3.0 # via -r requirements/test.txt edx-lint==5.3.6 # via -r requirements/quality.in @@ -126,7 +127,7 @@ jinja2==3.1.3 # via # -r requirements/test.txt # code-annotations -lxml==5.1.0 +lxml==5.2.1 # via # -r requirements/test.txt # xblock @@ -144,7 +145,7 @@ mccabe==0.7.0 # via pylint mock==5.1.0 # via -r requirements/test.txt -newrelic==9.7.1 +newrelic==9.8.0 # via # -r requirements/test.txt # edx-django-utils @@ -168,7 +169,7 @@ psutil==5.9.8 # edx-django-utils pycodestyle==2.11.1 # via -r requirements/quality.in -pycparser==2.21 +pycparser==2.22 # via # -r requirements/test.txt # cffi @@ -280,7 +281,7 @@ urllib3==2.2.1 # via # -r requirements/test.txt # requests -web-fragments==2.1.0 +web-fragments==2.2.0 # via # -r requirements/test.txt # xblock diff --git a/requirements/test.txt b/requirements/test.txt index 7d1cec2..31d106e 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -12,8 +12,9 @@ asgiref==3.8.1 # via # -r requirements/base.txt # django -backports-zoneinfo==0.2.1 +backports-zoneinfo==0.2.1 ; python_version < "3.9" # via + # -c requirements/constraints.txt # -r requirements/base.txt # django # djangorestframework @@ -59,7 +60,7 @@ django-crum==0.7.9 # via # -r requirements/base.txt # edx-django-utils -django-model-utils==4.4.0 +django-model-utils==4.5.0 # via -r requirements/base.txt django-waffle==4.1.0 # via @@ -75,11 +76,11 @@ drf-jwt==1.19.2 # via # -r requirements/base.txt # edx-drf-extensions -edx-django-utils==5.11.0 +edx-django-utils==5.12.0 # via # -r requirements/base.txt # edx-drf-extensions -edx-drf-extensions==10.2.0 +edx-drf-extensions==10.3.0 # via -r requirements/base.txt edx-opaque-keys==2.5.1 # via @@ -99,7 +100,7 @@ iniconfig==2.0.0 # via pytest jinja2==3.1.3 # via code-annotations -lxml==5.1.0 +lxml==5.2.1 # via # -r requirements/base.txt # xblock @@ -115,7 +116,7 @@ markupsafe==2.1.5 # xblock mock==5.1.0 # via -r requirements/test.in -newrelic==9.7.1 +newrelic==9.8.0 # via # -r requirements/base.txt # edx-django-utils @@ -131,7 +132,7 @@ psutil==5.9.8 # via # -r requirements/base.txt # edx-django-utils -pycparser==2.21 +pycparser==2.22 # via # -r requirements/base.txt # cffi @@ -213,7 +214,7 @@ urllib3==2.2.1 # via # -r requirements/base.txt # requests -web-fragments==2.1.0 +web-fragments==2.2.0 # via # -r requirements/base.txt # xblock