From 886700ab9a9f2dd55cae99425eff73ff94e17d00 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Thu, 12 Sep 2024 15:10:00 +0500 Subject: [PATCH 1/9] chore: Drop support for python 3.8 - Drop support for python 3.8 and add support for python 3.11 and 3.12 --- .github/workflows/ci.yml | 2 +- .github/workflows/pypi-publish.yml | 6 +++- requirements/base.txt | 26 ++++++-------- requirements/ci.txt | 35 ++++++++---------- requirements/pip.txt | 8 ++--- requirements/pip_tools.txt | 21 +++-------- requirements/quality.txt | 57 +++++++++++++----------------- requirements/test.txt | 16 +++++---- requirements/tox.txt | 22 +++++------- setup.py | 3 +- 10 files changed, 85 insertions(+), 111 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 17f7d6b..1bca2d7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,8 +15,8 @@ jobs: matrix: os: [ubuntu-20.04] python-version: - - '3.8' - '3.11' + - '3.12' toxenv: [django42, quality, csslint, eslint] steps: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index a8e10c3..29975bd 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -9,13 +9,17 @@ jobs: push: runs-on: ubuntu-20.04 + strategy: + matrix: + python-version: [3.11, 3.12] + steps: - name: Checkout uses: actions/checkout@v3 - name: setup python uses: actions/setup-python@v3 with: - python-version: 3.8 + python-version: ${{ matrix.python-version }} - name: Install pip run: pip install -r requirements/pip.txt diff --git a/requirements/base.txt b/requirements/base.txt index e7f0e0e..5c0f429 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade @@ -8,19 +8,15 @@ appdirs==1.4.4 # via fs 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 +django==4.2.16 # via # -c requirements/common_constraints.txt # -r requirements/base.in fs==2.4.16 # via xblock -lxml==5.2.1 +lxml==5.3.0 # via xblock -mako==1.3.2 +mako==1.3.5 # via xblock markupsafe==2.1.5 # via @@ -28,26 +24,24 @@ markupsafe==2.1.5 # xblock python-dateutil==2.9.0.post0 # via xblock -pytz==2024.1 +pytz==2024.2 # via xblock -pyyaml==6.0.1 +pyyaml==6.0.2 # via xblock -simplejson==3.19.2 +simplejson==3.19.3 # via xblock six==1.16.0 # via # -r requirements/base.in # fs # python-dateutil -sqlparse==0.4.4 +sqlparse==0.5.1 # via django -typing-extensions==4.10.0 - # via asgiref web-fragments==2.2.0 # via xblock -webob==1.8.7 +webob==1.8.8 # via xblock -xblock==3.1.0 +xblock==5.1.0 # via -r requirements/base.in # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/ci.txt b/requirements/ci.txt index 53fbcda..41238bd 100644 --- a/requirements/ci.txt +++ b/requirements/ci.txt @@ -1,14 +1,14 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade # -cachetools==5.3.3 +cachetools==5.5.0 # via # -r requirements/tox.txt # tox -certifi==2024.2.2 +certifi==2024.8.30 # via requests chardet==5.2.0 # via @@ -20,9 +20,9 @@ colorama==0.4.6 # via # -r requirements/tox.txt # tox -coverage==6.5.0 +coverage[toml]==7.6.1 # via coveralls -coveralls==3.3.1 +coveralls==4.0.1 # via -r requirements/ci.in distlib==0.3.8 # via @@ -30,43 +30,38 @@ distlib==0.3.8 # virtualenv docopt==0.6.2 # via coveralls -filelock==3.13.3 +filelock==3.16.0 # via # -r requirements/tox.txt # tox # virtualenv -idna==3.6 +idna==3.8 # via requests -packaging==24.0 +packaging==24.1 # via # -r requirements/tox.txt # pyproject-api # tox -platformdirs==4.2.0 +platformdirs==4.3.2 # via # -r requirements/tox.txt # tox # virtualenv -pluggy==1.4.0 +pluggy==1.5.0 # via # -r requirements/tox.txt # tox -pyproject-api==1.6.1 +pyproject-api==1.7.1 # via # -r requirements/tox.txt # tox -requests==2.31.0 +requests==2.32.3 # via coveralls -tomli==2.0.1 - # via - # -r requirements/tox.txt - # pyproject-api - # tox -tox==4.14.2 +tox==4.18.1 # via -r requirements/tox.txt -urllib3==2.2.1 +urllib3==2.2.2 # via requests -virtualenv==20.25.1 +virtualenv==20.26.4 # via # -r requirements/tox.txt # tox diff --git a/requirements/pip.txt b/requirements/pip.txt index cf44902..f313a9c 100644 --- a/requirements/pip.txt +++ b/requirements/pip.txt @@ -1,14 +1,14 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade # -wheel==0.43.0 +wheel==0.44.0 # via -r requirements/pip.in # The following packages are considered to be unsafe in a requirements file: -pip==24.0 +pip==24.2 # via -r requirements/pip.in -setuptools==69.2.0 +setuptools==74.1.2 # via -r requirements/pip.in diff --git a/requirements/pip_tools.txt b/requirements/pip_tools.txt index 4e1105e..77d81ad 100644 --- a/requirements/pip_tools.txt +++ b/requirements/pip_tools.txt @@ -1,34 +1,23 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade # -build==1.2.1 +build==1.2.2 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==6.11.0 - # via - # -c requirements/common_constraints.txt - # build -packaging==24.0 +packaging==24.1 # via build pip-tools==7.4.1 # via -r requirements/pip_tools.in -pyproject-hooks==1.0.0 - # via - # build - # pip-tools -tomli==2.0.1 +pyproject-hooks==1.1.0 # via # build # pip-tools - # pyproject-hooks -wheel==0.43.0 +wheel==0.44.0 # via pip-tools -zipp==3.18.1 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/quality.txt b/requirements/quality.txt index 4f436ba..2f37b71 100644 --- a/requirements/quality.txt +++ b/requirements/quality.txt @@ -1,5 +1,5 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade @@ -12,22 +12,21 @@ asgiref==3.8.1 # via # -r requirements/base.txt # django -astroid==3.1.0 +astroid==3.2.4 # via pylint -backports-zoneinfo==0.2.1 ; python_version < "3.9" - # via - # -c requirements/constraints.txt - # -r requirements/base.txt - # django -coverage==7.4.4 +coverage==7.6.1 # via -r requirements/test.txt dill==0.3.8 # via pylint -django==4.2.11 +django==4.2.16 # via # -c requirements/common_constraints.txt # -r requirements/base.txt -edx-opaque-keys==2.5.1 +dnspython==2.6.1 + # via + # -r requirements/test.txt + # pymongo +edx-opaque-keys==2.11.0 # via -r requirements/test.txt fs==2.4.16 # via @@ -35,11 +34,11 @@ fs==2.4.16 # xblock isort==5.13.2 # via pylint -lxml==5.2.1 +lxml==5.3.0 # via # -r requirements/base.txt # xblock -mako==1.3.2 +mako==1.3.5 # via # -r requirements/base.txt # xblock @@ -52,17 +51,17 @@ mccabe==0.7.0 # via pylint mock==5.1.0 # via -r requirements/test.txt -pbr==6.0.0 +pbr==6.1.0 # via # -r requirements/test.txt # stevedore -platformdirs==4.2.0 +platformdirs==4.3.2 # via pylint -pycodestyle==2.11.1 +pycodestyle==2.12.1 # via -r requirements/quality.in -pylint==3.1.0 +pylint==3.2.7 # via -r requirements/quality.in -pymongo==3.13.0 +pymongo==4.8.0 # via # -r requirements/test.txt # edx-opaque-keys @@ -70,15 +69,15 @@ python-dateutil==2.9.0.post0 # via # -r requirements/base.txt # xblock -pytz==2024.1 +pytz==2024.2 # via # -r requirements/base.txt # xblock -pyyaml==6.0.1 +pyyaml==6.0.2 # via # -r requirements/base.txt # xblock -simplejson==3.19.2 +simplejson==3.19.3 # via # -r requirements/base.txt # xblock @@ -87,35 +86,29 @@ six==1.16.0 # -r requirements/base.txt # fs # python-dateutil -sqlparse==0.4.4 +sqlparse==0.5.1 # via # -r requirements/base.txt # django -stevedore==5.2.0 +stevedore==5.3.0 # via # -r requirements/test.txt # edx-opaque-keys -tomli==2.0.1 - # via pylint -tomlkit==0.12.4 +tomlkit==0.13.2 # via pylint -typing-extensions==4.10.0 +typing-extensions==4.12.2 # via - # -r requirements/base.txt # -r requirements/test.txt - # asgiref - # astroid # edx-opaque-keys - # pylint web-fragments==2.2.0 # via # -r requirements/base.txt # xblock -webob==1.8.7 +webob==1.8.8 # via # -r requirements/base.txt # xblock -xblock==3.1.0 +xblock==5.1.0 # via -r requirements/base.txt # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/test.txt b/requirements/test.txt index 1f1b605..00a237d 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,20 +1,22 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade # -coverage==7.4.4 +coverage==7.6.1 # via -r requirements/test.in -edx-opaque-keys==2.5.1 +dnspython==2.6.1 + # via pymongo +edx-opaque-keys==2.11.0 # via -r requirements/test.in mock==5.1.0 # via -r requirements/test.in -pbr==6.0.0 +pbr==6.1.0 # via stevedore -pymongo==3.13.0 +pymongo==4.8.0 # via edx-opaque-keys -stevedore==5.2.0 +stevedore==5.3.0 # via edx-opaque-keys -typing-extensions==4.10.0 +typing-extensions==4.12.2 # via edx-opaque-keys diff --git a/requirements/tox.txt b/requirements/tox.txt index cc5293d..c6769e2 100644 --- a/requirements/tox.txt +++ b/requirements/tox.txt @@ -1,10 +1,10 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.11 # by the following command: # # make upgrade # -cachetools==5.3.3 +cachetools==5.5.0 # via tox chardet==5.2.0 # via tox @@ -12,27 +12,23 @@ colorama==0.4.6 # via tox distlib==0.3.8 # via virtualenv -filelock==3.13.3 +filelock==3.16.0 # via # tox # virtualenv -packaging==24.0 +packaging==24.1 # via # pyproject-api # tox -platformdirs==4.2.0 +platformdirs==4.3.2 # via # tox # virtualenv -pluggy==1.4.0 +pluggy==1.5.0 # via tox -pyproject-api==1.6.1 +pyproject-api==1.7.1 # via tox -tomli==2.0.1 - # via - # pyproject-api - # tox -tox==4.14.2 +tox==4.18.1 # via -r requirements/tox.in -virtualenv==20.25.1 +virtualenv==20.26.4 # via tox diff --git a/setup.py b/setup.py index a960fa5..ac51344 100644 --- a/setup.py +++ b/setup.py @@ -119,7 +119,8 @@ def is_requirement(line): 'Programming Language :: Python', 'Programming Language :: Python :: 3', 'Programming Language :: Python :: 3.5', - 'Programming Language :: Python :: 3.8', + 'Programming Language :: Python :: 3.11', + 'Programming Language :: Python :: 3.12', 'Framework :: Django', 'Framework :: Django :: 3.2', 'Framework :: Django :: 4.2', From e04949cbbb939e423360673827d18272867befb2 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Thu, 12 Sep 2024 15:16:37 +0500 Subject: [PATCH 2/9] chore: Replace pkg_resources lib with importlib.resources - transitioned from pkg_resources api to importlib-resources api --- submit_and_compare/mixins/scenario.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/submit_and_compare/mixins/scenario.py b/submit_and_compare/mixins/scenario.py index a28d2b8..b3bc50b 100644 --- a/submit_and_compare/mixins/scenario.py +++ b/submit_and_compare/mixins/scenario.py @@ -2,7 +2,8 @@ Mixin workbench behavior into XBlocks """ from glob import glob -import pkg_resources +import importlib +import importlib.resources def _read_file(file_path): @@ -66,7 +67,7 @@ def workbench_scenarios(cls): """ module = cls.__module__ module = module.split('.', maxsplit=1)[0] - directory = pkg_resources.resource_filename(module, 'scenarios') + directory = importlib.resources.files(module) / 'scenarios' files = _find_files(directory) scenarios = _read_files(files) return scenarios From 29554a96f48a38ec5b6ffefb8f2755d0c074edf6 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Fri, 13 Sep 2024 17:59:19 +0500 Subject: [PATCH 3/9] chore: Drop support for python 3.8 - Drop support for python 3.8 and add suppor for python 3.11 and 3.12 - update CHANGELOG entry - update tox.ini to drop python 3.8 and add support for 3.11 and 3.12 --- CHANGELOG.md | 1 + tox.ini | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d77eff4..9e5bac5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,3 +46,4 @@ Version 2.0.0 Version 2.1.0 Added support for python 3.11 support. Removed django 3.2 support. + Dropped support for Python 3.8 and added support for Python 3.12. diff --git a/tox.ini b/tox.ini index 1c459f1..a34ec5e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = csslint,eslint,pycodestyle,pylint,py{38, 311}-django{42} +envlist = csslint,eslint,pycodestyle,pylint,py{311, 312}-django{42} [testenv] deps = From 9a901acf6aafa21f83db6fbeb43782d730fd0804 Mon Sep 17 00:00:00 2001 From: "M. Tayyab Tahir Qureshi" <109274085+ttqureshi@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:49:08 +0500 Subject: [PATCH 4/9] chore: Version upgrade - CHANGELOG.md --- CHANGELOG.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9e5bac5..8cb305c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,4 +46,7 @@ Version 2.0.0 Version 2.1.0 Added support for python 3.11 support. Removed django 3.2 support. - Dropped support for Python 3.8 and added support for Python 3.12. + +Version 2.2.0 + + Dropped support for Python 3.8 and added support for Python 3.12. From c409d513c35c60ed5ac617e6a33c92b82c9f22b7 Mon Sep 17 00:00:00 2001 From: "M. Tayyab Tahir Qureshi" <109274085+ttqureshi@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:48:14 +0500 Subject: [PATCH 5/9] chore: Update Major Version - CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8cb305c..47cae1e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,6 @@ Version 2.1.0 Added support for python 3.11 support. Removed django 3.2 support. -Version 2.2.0 +Version 3.0.0 Dropped support for Python 3.8 and added support for Python 3.12. From c134aabb8da644d34840ef26c16cbb62336d666f Mon Sep 17 00:00:00 2001 From: "M. Tayyab Tahir Qureshi" <109274085+ttqureshi@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:00:06 +0500 Subject: [PATCH 6/9] style: following better syntax --- .github/workflows/ci.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 1bca2d7..3d23738 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,9 +14,7 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: - - '3.11' - - '3.12' + python-version: ['3.11', '3.12'] toxenv: [django42, quality, csslint, eslint] steps: From f3e243d5e2de8d6e1c432d52267bf35dd5c48ba2 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Mon, 16 Sep 2024 15:08:15 +0500 Subject: [PATCH 7/9] chore: drop support for Django 3.2 and Python 3.5 --- setup.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/setup.py b/setup.py index ac51344..2bfae72 100644 --- a/setup.py +++ b/setup.py @@ -118,11 +118,9 @@ def is_requirement(line): 'Programming Language :: JavaScript', 'Programming Language :: Python', 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.5', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Framework :: Django', - 'Framework :: Django :: 3.2', 'Framework :: Django :: 4.2', 'Topic :: Education', 'Topic :: Internet :: WWW/HTTP', From 5a9a84977749e279722bc9c0427433fb91cc72d1 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Mon, 16 Sep 2024 20:40:33 +0500 Subject: [PATCH 8/9] chore: migrate to resourceloader --- submit_and_compare/mixins/scenario.py | 61 +++------------------------ 1 file changed, 6 insertions(+), 55 deletions(-) diff --git a/submit_and_compare/mixins/scenario.py b/submit_and_compare/mixins/scenario.py index b3bc50b..83edc39 100644 --- a/submit_and_compare/mixins/scenario.py +++ b/submit_and_compare/mixins/scenario.py @@ -1,58 +1,14 @@ """ Mixin workbench behavior into XBlocks """ -from glob import glob -import importlib -import importlib.resources - -def _read_file(file_path): - """ - Read in a file's contents - """ - with open(file_path, encoding="utf-8") as file_input: - file_contents = file_input.read() - return file_contents - - -def _parse_title(file_path): - """ - Parse a title from a file name - """ - title = file_path - title = title.split('/')[-1] - title = '.'.join(title.split('.')[:-1]) - title = ' '.join(title.split('-')) - title = ' '.join([ - word.capitalize() - for word in title.split(' ') - ]) - return title +try: + from xblock.utils.resources import ResourceLoader +except ModuleNotFoundError: + from xblockutils.resources import ResourceLoader -def _read_files(files): - """ - Read the contents of a list of files - """ - file_contents = [ - ( - _parse_title(file_path), - _read_file(file_path), - ) - for file_path in files - ] - return file_contents - - -def _find_files(directory): - """ - Find XML files in the directory - """ - pattern = "{directory}/*.xml".format( - directory=directory, - ) - files = glob(pattern) - return files +loader = ResourceLoader(__name__) class XBlockWorkbenchMixin: @@ -65,9 +21,4 @@ def workbench_scenarios(cls): """ Gather scenarios to be displayed in the workbench """ - module = cls.__module__ - module = module.split('.', maxsplit=1)[0] - directory = importlib.resources.files(module) / 'scenarios' - files = _find_files(directory) - scenarios = _read_files(files) - return scenarios + return loader.load_scenarios_from_path("../scenarios") \ No newline at end of file From 31d4e3665df4a1f29edc08f29539a49ec8c6efb7 Mon Sep 17 00:00:00 2001 From: Muhammad Tayayb Tahir Qureshi Date: Mon, 23 Sep 2024 16:16:46 +0500 Subject: [PATCH 9/9] chore: Update major version --- CHANGELOG.md | 2 +- setup.py | 2 +- submit_and_compare/mixins/scenario.py | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47cae1e..64068d2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -49,4 +49,4 @@ Version 2.1.0 Version 3.0.0 - Dropped support for Python 3.8 and added support for Python 3.12. + Dropped support for Python 3.8 and added support for Python 3.11 and 3.12. diff --git a/setup.py b/setup.py index 2bfae72..f92e5df 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ from setuptools import find_packages, setup -version = '2.1.0' +version = '3.0.0' description = __doc__.strip().split('\n')[0] this_directory = path.abspath(path.dirname(__file__)) with open(path.join(this_directory, 'README.rst')) as file_in: diff --git a/submit_and_compare/mixins/scenario.py b/submit_and_compare/mixins/scenario.py index 83edc39..3b20c7b 100644 --- a/submit_and_compare/mixins/scenario.py +++ b/submit_and_compare/mixins/scenario.py @@ -21,4 +21,4 @@ def workbench_scenarios(cls): """ Gather scenarios to be displayed in the workbench """ - return loader.load_scenarios_from_path("../scenarios") \ No newline at end of file + return loader.load_scenarios_from_path("../scenarios")