Skip to content

Commit

Permalink
Merge pull request #445 from irtazaakram/python-312-support
Browse files Browse the repository at this point in the history
chore: add support for python 3.12
  • Loading branch information
feanil committed Aug 23, 2024
2 parents c825726 + eea0863 commit 08262a7
Show file tree
Hide file tree
Showing 16 changed files with 53 additions and 92 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pypi-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 7 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
~~~~~~~~~~~~~~~~~~

Expand Down
2 changes: 1 addition & 1 deletion edx_lint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
11 changes: 5 additions & 6 deletions edx_lint/pylint/annotations_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand Down
9 changes: 4 additions & 5 deletions edx_lint/write.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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):
Expand Down
16 changes: 5 additions & 11 deletions requirements/base.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -49,19 +49,13 @@ 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
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
10 changes: 3 additions & 7 deletions requirements/ci.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
21 changes: 5 additions & 16 deletions requirements/dev.txt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
12 changes: 2 additions & 10 deletions requirements/pip-tools.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions requirements/pip.txt
Original file line number Diff line number Diff line change
@@ -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
34 changes: 9 additions & 25 deletions requirements/test.txt
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -101,21 +97,21 @@ 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
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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

import os
import re
import setuptools
import setuptools # pylint: disable=E0401


def load_requirements(*requirements_paths):
Expand Down
Loading

0 comments on commit 08262a7

Please sign in to comment.