From e582cf8167f2f8858eb28eed4e262beba2e7c2af Mon Sep 17 00:00:00 2001 From: Omer Bhatti Date: Tue, 3 Sep 2024 17:48:06 +0500 Subject: [PATCH 1/6] chore: Drop py3.8 support | replace pkg_resource with importlib.resources * chore: transitioned from pkg_resources api to importlib-resources api * feat!: drop support for python 3.8 --- .github/workflows/ci.yml | 2 +- .github/workflows/pypi-publish.yml | 2 +- image_explorer/image_explorer.py | 6 +++--- setup.py | 3 +-- tox.ini | 2 +- 5 files changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9164a06..49c1be5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: fail-fast: false matrix: os: [ubuntu-20.04] - python-version: ['3.8', '3.11', '3.12'] + python-version: ['3.11', '3.12'] toxenv: [django42, quality, package] steps: diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 527dc58..ebed6c5 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -15,7 +15,7 @@ jobs: - name: setup python uses: actions/setup-python@v4 with: - python-version: 3.8 + python-version: 3.11 - name: Install Dependencies run: pip install -r requirements/pip.txt diff --git a/image_explorer/image_explorer.py b/image_explorer/image_explorer.py index a3075a2..9325698 100644 --- a/image_explorer/image_explorer.py +++ b/image_explorer/image_explorer.py @@ -30,7 +30,7 @@ import textwrap from io import StringIO from urllib.parse import urljoin -import pkg_resources +import importlib.resources from django.conf import settings from lxml import etree, html @@ -465,5 +465,5 @@ def workbench_scenarios(): def resource_string(self, path): """Handy helper for getting resources from our kit.""" - data = pkg_resources.resource_string(__name__, path) - return data.decode("utf8") + data = importlib.resources.files(__package__).joinpath(path) + return data.read_text(encoding="utf-8") diff --git a/setup.py b/setup.py index c7f845d..dda7ffa 100644 --- a/setup.py +++ b/setup.py @@ -114,7 +114,6 @@ def package_data(pkg, root_list): long_description_content_type='text/markdown', classifiers=[ 'Programming Language :: Python', - 'Programming Language :: Python :: 3.8', 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', 'Framework :: Django', @@ -127,5 +126,5 @@ def package_data(pkg, root_list): }, packages=['image_explorer'], package_data=package_data("image_explorer", ["static", "templates", "public", "translations"]), - python_requires=">=3.8", + python_requires=">=3.11", ) diff --git a/tox.ini b/tox.ini index 48292db..9849b4e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{38,311,312}-django{42},quality,package +envlist = py{311,312}-django{42},quality,package [pytest] DJANGO_SETTINGS_MODULE = workbench.settings From 622e12137c5effc3665ea8583764975982b170bf Mon Sep 17 00:00:00 2001 From: Omer Bhatti Date: Mon, 9 Sep 2024 13:24:15 +0500 Subject: [PATCH 2/6] chore: updated xblock version to latest --- requirements/base.txt | 2 +- requirements/test.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 1b6cdc0..1f19d51 100644 --- a/requirements/base.txt +++ b/requirements/base.txt @@ -83,7 +83,7 @@ web-fragments==2.2.0 # via xblock webob==1.8.7 # via xblock -xblock[django]==4.0.1 +xblock[django]==5.0.0 # via -r requirements/base.in # The following packages are considered to be unsafe in a requirements file: diff --git a/requirements/test.txt b/requirements/test.txt index ae67f31..4576d06 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -255,7 +255,7 @@ webob==1.8.7 # -r requirements/base.txt # xblock # xblock-sdk -xblock[django]==4.0.1 +xblock[django]==5.0.0 # via # -r requirements/base.txt # xblock From e3bb34a5af392e3e5d5feacaa8973e8fbaea8340 Mon Sep 17 00:00:00 2001 From: Omer Bhatti Date: Tue, 10 Sep 2024 13:48:59 +0500 Subject: [PATCH 3/6] chore: Updating Python Requirements --- requirements/base.txt | 32 +++++++--------- requirements/ci.txt | 16 +++----- requirements/pip-tools.txt | 12 ++---- requirements/pip.txt | 8 ++-- requirements/test.txt | 76 +++++++++++++++----------------------- 5 files changed, 55 insertions(+), 89 deletions(-) diff --git a/requirements/base.txt b/requirements/base.txt index 1f19d51..4422620 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 -boto3==1.34.131 +boto3==1.35.15 # via fs-s3fs -botocore==1.34.131 +botocore==1.35.15 # via # boto3 # s3transfer cssselect==1.2.0 # via parsel -django==4.2.13 +django==4.2.16 # via # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # openedx-django-pyfs @@ -37,7 +33,7 @@ jmespath==1.0.1 # botocore lazy==1.6 # via xblock -lxml==5.2.2 +lxml==5.3.0 # via # parsel # xblock @@ -47,7 +43,7 @@ markupsafe==2.1.5 # via # mako # xblock -openedx-django-pyfs==3.6.0 +openedx-django-pyfs==3.7.0 # via xblock parsel==1.6.0 # via @@ -59,11 +55,11 @@ python-dateutil==2.9.0.post0 # xblock pytz==2024.1 # via xblock -pyyaml==6.0.1 +pyyaml==6.0.2 # via xblock -s3transfer==0.10.1 +s3transfer==0.10.2 # via boto3 -simplejson==3.19.2 +simplejson==3.19.3 # via xblock six==1.16.0 # via @@ -71,19 +67,17 @@ six==1.16.0 # fs-s3fs # parsel # python-dateutil -sqlparse==0.5.0 +sqlparse==0.5.1 # via django -typing-extensions==4.12.2 - # via asgiref -urllib3==1.26.19 +urllib3==2.2.2 # via botocore w3lib==2.2.1 # via parsel web-fragments==2.2.0 # via xblock -webob==1.8.7 +webob==1.8.8 # via xblock -xblock[django]==5.0.0 +xblock[django]==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 154d9d0..f119430 100644 --- a/requirements/ci.txt +++ b/requirements/ci.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,7 +12,7 @@ colorama==0.4.6 # via tox distlib==0.3.8 # via virtualenv -filelock==3.15.4 +filelock==3.16.0 # via # tox # virtualenv @@ -20,7 +20,7 @@ packaging==24.1 # via # pyproject-api # tox -platformdirs==4.2.2 +platformdirs==4.3.2 # via # tox # virtualenv @@ -28,11 +28,7 @@ pluggy==1.5.0 # via tox pyproject-api==1.7.1 # via tox -tomli==2.0.1 - # via - # pyproject-api - # tox -tox==4.15.1 +tox==4.18.1 # via -r requirements/ci.in -virtualenv==20.26.3 +virtualenv==20.26.4 # via tox diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index f4e8140..7436f28 100644 --- a/requirements/pip-tools.txt +++ b/requirements/pip-tools.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 @@ -13,9 +13,7 @@ click==8.1.7 # -r requirements/pip-tools.in # pip-tools importlib-metadata==7.0.1 - # via - # -r requirements/pip-tools.in - # build + # via -r requirements/pip-tools.in packaging==23.2 # via # -r requirements/pip-tools.in @@ -27,11 +25,7 @@ pyproject-hooks==1.0.0 # -r requirements/pip-tools.in # build tomli==2.0.1 - # via - # -r requirements/pip-tools.in - # build - # pip-tools - # pyproject-hooks + # via -r requirements/pip-tools.in wheel==0.42.0 # via # -r requirements/pip-tools.in diff --git a/requirements/pip.txt b/requirements/pip.txt index c9a36e3..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.1 +pip==24.2 # via -r requirements/pip.in -setuptools==70.1.0 +setuptools==74.1.2 # via -r requirements/pip.in diff --git a/requirements/test.txt b/requirements/test.txt index 4576d06..9e49075 100644 --- a/requirements/test.txt +++ b/requirements/test.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 @@ -14,27 +14,22 @@ asgiref==3.8.1 # via # -r requirements/base.txt # django -astroid==3.2.2 +astroid==3.2.4 # via # pylint # pylint-celery -backports-zoneinfo==0.2.1 ; python_version < "3.9" - # via - # -c requirements/constraints.txt - # -r requirements/base.txt - # django binaryornot==0.4.4 # via cookiecutter -boto3==1.34.131 +boto3==1.35.15 # via # -r requirements/base.txt # fs-s3fs -botocore==1.34.131 +botocore==1.35.15 # via # -r requirements/base.txt # boto3 # s3transfer -certifi==2024.6.2 +certifi==2024.8.30 # via requests chardet==5.2.0 # via binaryornot @@ -52,7 +47,7 @@ code-annotations==1.8.0 # via edx-lint cookiecutter==2.6.0 # via xblock-sdk -coverage[toml]==7.5.4 +coverage[toml]==7.6.1 # via # coverage # pytest-cov @@ -62,15 +57,14 @@ cssselect==1.2.0 # parsel dill==0.3.8 # via pylint +django==4.2.16 # via # -c https://raw.githubusercontent.com/edx/edx-lint/master/edx_lint/files/common_constraints.txt # -r requirements/base.txt # openedx-django-pyfs # xblock-sdk -edx-lint==5.3.6 +edx-lint==5.4.0 # via -r requirements/test.in -exceptiongroup==1.2.1 - # via pytest fs==2.4.16 # via # -r requirements/base.txt @@ -82,7 +76,7 @@ fs-s3fs==1.1.1 # -r requirements/base.txt # openedx-django-pyfs # xblock-sdk -idna==3.7 +idna==3.8 # via requests iniconfig==2.0.0 # via pytest @@ -101,7 +95,7 @@ lazy==1.6 # via # -r requirements/base.txt # xblock -lxml==5.2.2 +lxml==5.3.0 # via # -r requirements/base.txt # parsel @@ -125,7 +119,7 @@ mdurl==0.1.2 # via markdown-it-py mock==5.1.0 # via -r requirements/test.in -openedx-django-pyfs==3.6.0 +openedx-django-pyfs==3.7.0 # via # -r requirements/base.txt # xblock @@ -135,17 +129,17 @@ parsel==1.6.0 # via # -c requirements/constraints.txt # -r requirements/base.txt -pbr==6.0.0 +pbr==6.1.0 # via stevedore -platformdirs==4.2.2 +platformdirs==4.3.2 # via pylint pluggy==1.5.0 # via pytest -pycodestyle==2.12.0 +pycodestyle==2.12.1 # via -r requirements/test.in pygments==2.18.0 # via rich -pylint==3.2.3 +pylint==3.2.7 # via # edx-lint # pylint-celery @@ -161,13 +155,13 @@ pylint-plugin-utils==0.8.2 # pylint-django pypng==0.20220715.0 # via xblock-sdk -pytest==8.2.2 +pytest==8.3.2 # via # pytest-cov # pytest-django pytest-cov==5.0.0 # via -r requirements/test.in -pytest-django==4.8.0 +pytest-django==4.9.0 # via -r requirements/test.in python-dateutil==2.9.0.post0 # via @@ -183,7 +177,7 @@ pytz==2024.1 # via # -r requirements/base.txt # xblock -pyyaml==6.0.1 +pyyaml==6.0.2 # via # -r requirements/base.txt # code-annotations @@ -193,13 +187,13 @@ requests==2.32.3 # via # cookiecutter # xblock-sdk -rich==13.7.1 +rich==13.8.0 # via cookiecutter -s3transfer==0.10.1 +s3transfer==0.10.2 # via # -r requirements/base.txt # boto3 -simplejson==3.19.2 +simplejson==3.19.3 # via # -r requirements/base.txt # xblock @@ -212,31 +206,19 @@ six==1.16.0 # fs-s3fs # parsel # python-dateutil -sqlparse==0.5.0 +sqlparse==0.5.1 # via # -r requirements/base.txt # django -stevedore==5.2.0 +stevedore==5.3.0 # via code-annotations text-unidecode==1.3 # via python-slugify -tomli==2.0.1 - # via - # coverage - # pylint - # pytest -tomlkit==0.12.5 +tomlkit==0.13.2 # via pylint -types-python-dateutil==2.9.0.20240316 +types-python-dateutil==2.9.0.20240906 # via arrow -typing-extensions==4.12.2 - # via - # -r requirements/base.txt - # asgiref - # astroid - # pylint - # rich -urllib3==1.26.19 +urllib3==2.2.2 # via # -r requirements/base.txt # botocore @@ -250,17 +232,17 @@ web-fragments==2.2.0 # -r requirements/base.txt # xblock # xblock-sdk -webob==1.8.7 +webob==1.8.8 # via # -r requirements/base.txt # xblock # xblock-sdk -xblock[django]==5.0.0 +xblock[django]==5.1.0 # via # -r requirements/base.txt # xblock # xblock-sdk -xblock-sdk==0.11.0 +xblock-sdk==0.12.0 # via -r requirements/test.in # The following packages are considered to be unsafe in a requirements file: From 18cf5040395e9070a5a946d30b1a1f4845bd4c11 Mon Sep 17 00:00:00 2001 From: Omer Bhatti Date: Tue, 10 Sep 2024 14:48:15 +0500 Subject: [PATCH 4/6] chore: replace importlib with loader.load_unicode of Xblock --- image_explorer/image_explorer.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/image_explorer/image_explorer.py b/image_explorer/image_explorer.py index 9325698..abb8b6f 100644 --- a/image_explorer/image_explorer.py +++ b/image_explorer/image_explorer.py @@ -30,7 +30,6 @@ import textwrap from io import StringIO from urllib.parse import urljoin -import importlib.resources from django.conf import settings from lxml import etree, html @@ -465,5 +464,4 @@ def workbench_scenarios(): def resource_string(self, path): """Handy helper for getting resources from our kit.""" - data = importlib.resources.files(__package__).joinpath(path) - return data.read_text(encoding="utf-8") + return loader.load_unicode(path) From 1d0cbd942496ff878a1329d04404bc4f6ebcef02 Mon Sep 17 00:00:00 2001 From: M Omer Bhatti Date: Fri, 27 Sep 2024 19:06:57 +0500 Subject: [PATCH 5/6] revert: revert back os version change during rebasing --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c4ce6f..0349e12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: strategy: fail-fast: false matrix: - os: [ubuntu-20.04] + os: [ubuntu-latest] python-version: ['3.11', '3.12'] toxenv: [django42, quality, package] From 4cc8dc6c8f82b6f9ee11b281a289f793c85e1b55 Mon Sep 17 00:00:00 2001 From: M Omer Bhatti Date: Fri, 27 Sep 2024 19:36:07 +0500 Subject: [PATCH 6/6] chore!: Drop Python 3.8 support BREAKING CHANGE: This commit drops support for Python 3.8, requiring Python 3.11 or later. It is incompatible with releases older than Redwood. --- image_explorer/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/image_explorer/__init__.py b/image_explorer/__init__.py index 467efa7..249df53 100644 --- a/image_explorer/__init__.py +++ b/image_explorer/__init__.py @@ -22,4 +22,4 @@ """ from .image_explorer import ImageExplorerBlock -__version__ = '2.2.1' +__version__ = '3.0.0'