diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9798706..2c0a758 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: [py38, pylint] + python-version: ['3.12'] + toxenv: [py312, pylint] steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/pypi-publish.yml b/.github/workflows/pypi-publish.yml index 1a4f94f..a84430f 100644 --- a/.github/workflows/pypi-publish.yml +++ b/.github/workflows/pypi-publish.yml @@ -16,7 +16,7 @@ jobs: - name: setup python uses: actions/setup-python@v5 with: - python-version: 3.8 + python-version: 3.12 - name: Install pip run: pip install -r requirements/pip.txt diff --git a/CHANGELOG.rst b/CHANGELOG.rst index 8f702a1..4f1ba05 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,13 @@ Change Log Unreleased ~~~~~~~~~~ +5.4.0 - 2024-08-23 +~~~~~~~~~~~~~~~~~~ + +* Added support for python 3.12 +* Drop support for python 3.8 +* Replaced pkg_resources with importlib.resources + 5.3.7 - 2024-07-15 ~~~~~~~~~~~~~~~~~~ diff --git a/edx_lint/__init__.py b/edx_lint/__init__.py index ac8bf81..de8bee6 100644 --- a/edx_lint/__init__.py +++ b/edx_lint/__init__.py @@ -2,4 +2,4 @@ edx_lint standardizes lint configuration and additional plugins for use in Open edX code. """ -__version__ = "5.3.7" +__version__ = "5.4.0" diff --git a/edx_lint/pylint/annotations_check.py b/edx_lint/pylint/annotations_check.py index b787276..b23d66d 100644 --- a/edx_lint/pylint/annotations_check.py +++ b/edx_lint/pylint/annotations_check.py @@ -2,11 +2,9 @@ Pylint plugin: checks that feature toggles are properly annotated. """ -import os +import importlib.resources import re -import pkg_resources - from astroid.nodes.node_classes import Const, Name from code_annotations import annotation_errors from code_annotations.base import AnnotationConfig @@ -255,9 +253,10 @@ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.config_search = [] for config_filename in self.CONFIG_FILENAMES: - config_path = pkg_resources.resource_filename( - "code_annotations", - os.path.join("contrib", "config", config_filename), + config_path = str( + importlib.resources.files("code_annotations").joinpath( + "contrib", "config", config_filename + ) ) config = AnnotationConfig(config_path, verbosity=-1) search = StaticSearch(config) diff --git a/edx_lint/write.py b/edx_lint/write.py index 4dda380..e3321e6 100644 --- a/edx_lint/write.py +++ b/edx_lint/write.py @@ -2,17 +2,16 @@ The logic for writing shared files. """ +import importlib.resources import os import os.path -import pkg_resources -from six.moves import cStringIO -from six.moves import configparser +from six.moves import configparser, cStringIO from edx_lint import __version__ from edx_lint.configfile import merge_configs -from edx_lint.tamper_evident import TamperEvidentFile from edx_lint.metadata import KNOWN_FILES +from edx_lint.tamper_evident import TamperEvidentFile def make_header(metadata, filename, tweaks_name): @@ -169,7 +168,7 @@ def write_file(filename, output_fn): def get_file_content(filename): """Get the contents of the file that should be written.""" - return pkg_resources.resource_string("edx_lint", f"files/{filename}").decode("utf8") + return importlib.resources.files("edx_lint").joinpath(f"files/{filename}").read_text(encoding="utf-8") def amend_filename(filename, amend): diff --git a/requirements/base.txt b/requirements/base.txt index c0a6b88..e49e9d1 100644 --- a/requirements/base.txt +++ b/requirements/base.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.12 # by the following command: # # make upgrade # -astroid==3.2.3 +astroid==3.2.4 # via # pylint # pylint-celery @@ -33,7 +33,7 @@ pbr==6.0.0 # via stevedore platformdirs==4.2.2 # via pylint -pylint==3.2.5 +pylint==3.2.6 # via # -r requirements/base.in # pylint-celery @@ -49,7 +49,7 @@ pylint-plugin-utils==0.8.2 # pylint-django python-slugify==8.0.4 # via code-annotations -pyyaml==6.0.1 +pyyaml==6.0.2 # via code-annotations six==1.16.0 # via -r requirements/base.in @@ -57,11 +57,5 @@ stevedore==5.2.0 # via code-annotations text-unidecode==1.3 # via python-slugify -tomli==2.0.1 +tomlkit==0.13.2 # via pylint -tomlkit==0.13.0 - # via pylint -typing-extensions==4.12.2 - # via - # astroid - # pylint diff --git a/requirements/ci.txt b/requirements/ci.txt index 2129e93..d15675b 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.12 # by the following command: # # make upgrade # -cachetools==5.3.3 +cachetools==5.5.0 # via tox chardet==5.2.0 # via tox @@ -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.16.0 +tox==4.18.0 # via -r requirements/ci.in virtualenv==20.26.3 # via tox diff --git a/requirements/dev.txt b/requirements/dev.txt index 4d123dc..f84487b 100644 --- a/requirements/dev.txt +++ b/requirements/dev.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.12 # by the following command: # # make upgrade # -astroid==3.2.3 +astroid==3.2.4 # via # -r requirements/base.txt # pylint @@ -63,7 +63,7 @@ pluggy==1.5.0 # via tox py==1.11.0 # via tox -pylint==3.2.5 +pylint==3.2.6 # via # -r requirements/base.txt # pylint-celery @@ -82,7 +82,7 @@ python-slugify==8.0.4 # via # -r requirements/base.txt # code-annotations -pyyaml==6.0.1 +pyyaml==6.0.2 # via # -r requirements/base.txt # code-annotations @@ -98,13 +98,7 @@ text-unidecode==1.3 # via # -r requirements/base.txt # python-slugify -tomli==2.0.1 - # via - # -r requirements/base.txt - # pylint - # pyproject-api - # tox -tomlkit==0.13.0 +tomlkit==0.13.2 # via # -r requirements/base.txt # pylint @@ -114,10 +108,5 @@ tox==3.28.0 # tox-battery tox-battery==0.6.2 # via -r requirements/dev.in -typing-extensions==4.12.2 - # via - # -r requirements/base.txt - # astroid - # pylint virtualenv==20.26.3 # via tox diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 6b0824f..67b6039 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.12 # by the following command: # # make upgrade @@ -8,8 +8,6 @@ build==1.2.1 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==8.0.0 - # via build packaging==24.1 # via build pip-tools==7.4.1 @@ -18,14 +16,8 @@ pyproject-hooks==1.1.0 # via # build # pip-tools -tomli==2.0.1 - # via - # build - # pip-tools -wheel==0.43.0 +wheel==0.44.0 # via pip-tools -zipp==3.19.2 - # via importlib-metadata # The following packages are considered to be unsafe in a requirements file: # pip diff --git a/requirements/pip.txt b/requirements/pip.txt index e155dab..ec44049 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.12 # 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.2 +pip==24.2 # via -r requirements/pip.in -setuptools==70.3.0 +setuptools==72.2.0 # via -r requirements/pip.in diff --git a/requirements/test.txt b/requirements/test.txt index 59f501a..434a9a1 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1,18 +1,16 @@ # -# This file is autogenerated by pip-compile with Python 3.8 +# This file is autogenerated by pip-compile with Python 3.12 # by the following command: # # make upgrade # asgiref==3.8.1 # via django -astroid==3.2.3 +astroid==3.2.4 # via # -r requirements/dev.txt # pylint # pylint-celery -backports-zoneinfo==0.2.1 - # via django click==8.1.7 # via # -r requirements/dev.txt @@ -24,7 +22,7 @@ code-annotations==1.8.0 # via # -c requirements/constraints.txt # -r requirements/dev.txt -coverage==7.6.0 +coverage==7.6.1 # via -r requirements/test.in dill==0.3.8 # via @@ -34,12 +32,10 @@ distlib==0.3.8 # via # -r requirements/dev.txt # virtualenv -django==4.2.14 +django==4.2.15 # via # -c requirements/../edx_lint/files/common_constraints.txt # -r requirements/test.in -exceptiongroup==1.2.2 - # via pytest filelock==3.15.4 # via # -r requirements/dev.txt @@ -86,7 +82,7 @@ py==1.11.0 # via # -r requirements/dev.txt # tox -pylint==3.2.5 +pylint==3.2.6 # via # -r requirements/dev.txt # pylint-celery @@ -101,13 +97,13 @@ pylint-plugin-utils==0.8.2 # -r requirements/dev.txt # pylint-celery # pylint-django -pytest==8.2.2 +pytest==8.3.2 # via -r requirements/test.in python-slugify==8.0.4 # via # -r requirements/dev.txt # code-annotations -pyyaml==6.0.1 +pyyaml==6.0.2 # via # -r requirements/dev.txt # code-annotations @@ -115,7 +111,7 @@ six==1.16.0 # via # -r requirements/dev.txt # tox -sqlparse==0.5.0 +sqlparse==0.5.1 # via django stevedore==5.2.0 # via @@ -125,13 +121,7 @@ text-unidecode==1.3 # via # -r requirements/dev.txt # python-slugify -tomli==2.0.1 - # via - # -r requirements/dev.txt - # pylint - # pytest - # tox -tomlkit==0.13.0 +tomlkit==0.13.2 # via # -r requirements/dev.txt # pylint @@ -141,12 +131,6 @@ tox==3.28.0 # tox-battery tox-battery==0.6.2 # via -r requirements/dev.txt -typing-extensions==4.12.2 - # via - # -r requirements/dev.txt - # asgiref - # astroid - # pylint virtualenv==20.26.3 # via # -r requirements/dev.txt diff --git a/setup.cfg b/setup.cfg index 8b90005..cbf04ae 100644 --- a/setup.cfg +++ b/setup.cfg @@ -15,7 +15,7 @@ classifiers = Intended Audience :: Developers License :: OSI Approved :: Apache Software License Operating System :: OS Independent - Programming Language :: Python :: 3.8 + Programming Language :: Python :: 3.12 Topic :: Software Development :: Quality Assurance [options] diff --git a/setup.py b/setup.py index a3dd2a9..e97a46c 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ import os import re -import setuptools +import setuptools # pylint: disable=E0401 def load_requirements(*requirements_paths): diff --git a/test/plugins/pylint_test.py b/test/plugins/pylint_test.py index 35e73f1..e82871c 100644 --- a/test/plugins/pylint_test.py +++ b/test/plugins/pylint_test.py @@ -121,7 +121,8 @@ def test_invalid_python(): messages = run_pylint(source, "all") assert len(messages) == 1 message = messages.pop() - assert message == "1:syntax-error:Parsing failed: 'invalid syntax (source, line 1)'" + assert message == "1:syntax-error:Parsing failed: 'unterminated string "\ + "literal (detected at line 1) (source, line 1)'" # I would have tested that the msgids must be valid, but pylint doesn't seem diff --git a/tox.ini b/tox.ini index 0c70e9e..beec253 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38, coverage, pylint +envlist = py312, coverage, pylint [testenv] deps =