From 3c4caa1b8167f4126a8a7f4bb0c53a99af748016 Mon Sep 17 00:00:00 2001 From: Omer Bhatti Date: Tue, 3 Sep 2024 15:08:01 +0500 Subject: [PATCH] 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