From 8c8590ac0dbd286419680d410f33c19fb5fa744b Mon Sep 17 00:00:00 2001 From: Brian Mesick Date: Thu, 15 Feb 2024 10:42:29 -0500 Subject: [PATCH] chore: Updates to support Python up to 3.12 --- .github/workflows/ci.yml | 5 ++--- CHANGELOG.rst | 6 ++++++ edx_lint/__init__.py | 2 +- edx_lint/pylint/annotations_check.py | 1 + edx_lint/write.py | 1 + requirements/base.in | 1 + requirements/base.txt | 11 ++++------- requirements/ci.txt | 6 +----- requirements/dev.txt | 13 +------------ requirements/pip-tools.txt | 11 +---------- requirements/pip.txt | 2 +- requirements/test.txt | 16 +--------------- test/plugins/pylint_test.py | 8 ++++++-- tox.ini | 2 +- 14 files changed, 28 insertions(+), 57 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 97987067..d398e696 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,7 +7,6 @@ on: branches: - '**' - jobs: run_tests: name: tests @@ -15,8 +14,8 @@ jobs: strategy: matrix: os: [ubuntu-20.04] - python-version: ['3.8'] - toxenv: [py38, pylint] + python-version: ['3.12'] + toxenv: [py38, py312, pylint] steps: - uses: actions/checkout@v4 diff --git a/CHANGELOG.rst b/CHANGELOG.rst index a3161799..fb589de2 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -13,6 +13,12 @@ Change Log Unreleased ~~~~~~~~~~ +5.4.0 - 2024-02-15 +~~~~~~~~~~~~~~~~~~ + +* added support for Python 3.8 - 3.12 + + 5.3.5 - 2023-04-29 ~~~~~~~~~~~~~~~~~~ diff --git a/edx_lint/__init__.py b/edx_lint/__init__.py index ca0d1b3d..de8bee69 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.6" +__version__ = "5.4.0" diff --git a/edx_lint/pylint/annotations_check.py b/edx_lint/pylint/annotations_check.py index b787276c..42ba776d 100644 --- a/edx_lint/pylint/annotations_check.py +++ b/edx_lint/pylint/annotations_check.py @@ -259,6 +259,7 @@ def __init__(self, *args, **kwargs): "code_annotations", os.path.join("contrib", "config", config_filename), ) + config = AnnotationConfig(config_path, verbosity=-1) search = StaticSearch(config) self.config_search.append((config, search)) diff --git a/edx_lint/write.py b/edx_lint/write.py index 4dda3803..af0f021b 100644 --- a/edx_lint/write.py +++ b/edx_lint/write.py @@ -6,6 +6,7 @@ import os.path import pkg_resources + from six.moves import cStringIO from six.moves import configparser diff --git a/requirements/base.in b/requirements/base.in index 7e6238a8..a3d1ea92 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -6,4 +6,5 @@ click-log pylint pylint-django pylint-celery +setuptools six diff --git a/requirements/base.txt b/requirements/base.txt index 814a1819..f639ab39 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.12 # by the following command: # # make upgrade @@ -57,11 +57,8 @@ stevedore==5.1.0 # via code-annotations text-unidecode==1.3 # via python-slugify -tomli==2.0.1 - # via pylint tomlkit==0.12.3 # via pylint -typing-extensions==4.9.0 - # via - # astroid - # pylint + +# The following packages are considered to be unsafe in a requirements file: +# setuptools diff --git a/requirements/ci.txt b/requirements/ci.txt index 742e39c1..9d192947 100644 --- a/requirements/ci.txt +++ b/requirements/ci.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 @@ -28,10 +28,6 @@ pluggy==1.4.0 # via tox pyproject-api==1.6.1 # via tox -tomli==2.0.1 - # via - # pyproject-api - # tox tox==4.12.1 # via -r requirements/ci.in virtualenv==20.25.0 diff --git a/requirements/dev.txt b/requirements/dev.txt index ad8ce51e..34971a18 100644 --- a/requirements/dev.txt +++ b/requirements/dev.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 @@ -98,12 +98,6 @@ 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.12.3 # via # -r requirements/base.txt @@ -114,10 +108,5 @@ tox==3.28.0 # tox-battery tox-battery==0.6.2 # via -r requirements/dev.in -typing-extensions==4.9.0 - # via - # -r requirements/base.txt - # astroid - # pylint virtualenv==20.25.0 # via tox diff --git a/requirements/pip-tools.txt b/requirements/pip-tools.txt index 0e882265..b4998f80 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,23 +8,14 @@ build==1.0.3 # via pip-tools click==8.1.7 # via pip-tools -importlib-metadata==7.0.1 - # via build packaging==23.2 # via build pip-tools==7.3.0 # via -r requirements/pip-tools.in pyproject-hooks==1.0.0 # via build -tomli==2.0.1 - # via - # build - # pip-tools - # pyproject-hooks wheel==0.42.0 # via pip-tools -zipp==3.17.0 - # 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 71954cc6..4cfa72f5 100644 --- a/requirements/pip.txt +++ b/requirements/pip.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 diff --git a/requirements/test.txt b/requirements/test.txt index d376bf30..f9b887c2 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.12 # by the following command: # # make upgrade @@ -36,8 +36,6 @@ django==3.2.24 # via # -c requirements/../edx_lint/files/common_constraints.txt # -r requirements/test.in -exceptiongroup==1.2.0 - # via pytest filelock==3.13.1 # via # -r requirements/dev.txt @@ -125,12 +123,6 @@ 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.12.3 # via # -r requirements/dev.txt @@ -141,12 +133,6 @@ tox==3.28.0 # tox-battery tox-battery==0.6.2 # via -r requirements/dev.txt -typing-extensions==4.9.0 - # via - # -r requirements/dev.txt - # asgiref - # astroid - # pylint virtualenv==20.25.0 # via # -r requirements/dev.txt diff --git a/test/plugins/pylint_test.py b/test/plugins/pylint_test.py index a6c3342f..450f10b6 100644 --- a/test/plugins/pylint_test.py +++ b/test/plugins/pylint_test.py @@ -123,8 +123,12 @@ def test_invalid_python(): message = messages.pop() # Pylint 1.x says the source is , Pylint 2.x says message = message.replace("", "XXX").replace("", "XXX") - assert message == "1:syntax-error:Parsing failed: 'invalid syntax (XXX, line 1)'" - + assert message in ( + # Pre python 3.12 this error is returned + "1:syntax-error:Parsing failed: 'invalid syntax (XXX, line 1)'", + # Pythong 3.12+ this is the error + "1:syntax-error:Parsing failed: 'unterminated string literal (detected at line 1) (XXX, line 1)'", + ) # I would have tested that the msgids must be valid, but pylint doesn't seem # to mind being told to enable non-existent msgids. diff --git a/tox.ini b/tox.ini index 0c70e9e0..027edc8e 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py38, coverage, pylint +envlist = py{38,39,310,311,312}, coverage, pylint [testenv] deps =