From ca41058731ccf9a6a2a5fc6e12000bab6319bf61 Mon Sep 17 00:00:00 2001 From: Ty Hob Date: Tue, 8 Apr 2025 09:14:19 -0400 Subject: [PATCH 1/2] chore: Add support for Django 5.2 --- .github/workflows/ci.yml | 4 +-- setup.py | 77 ++++++++++++++++++++-------------------- tox.ini | 3 +- 3 files changed, 43 insertions(+), 41 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0f6074f..7b9dbb9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,8 +14,8 @@ jobs: strategy: matrix: os: [ubuntu-latest] - python-version: ['3.11', '3.12'] - toxenv: [quality, docs, django42] + python-version: ["3.11", "3.12"] + toxenv: [quality, docs, django42, django52] steps: - uses: actions/checkout@v4 diff --git a/setup.py b/setup.py index 1ae750c..9d32f44 100644 --- a/setup.py +++ b/setup.py @@ -16,11 +16,10 @@ def get_version(*file_paths): """ filename = os.path.join(os.path.dirname(__file__), *file_paths) version_file = open(filename).read() - version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", - version_file, re.M) + version_match = re.search(r"^__version__ = ['\"]([^'\"]*)['\"]", version_file, re.M) if version_match: return version_match.group(1) - raise RuntimeError('Unable to find version string.') + raise RuntimeError("Unable to find version string.") def load_requirements(*requirements_paths): @@ -33,7 +32,8 @@ def load_requirements(*requirements_paths): requirements = set() for path in requirements_paths: requirements.update( - line.split('#')[0].strip() for line in open(path).readlines() + line.split("#")[0].strip() + for line in open(path).readlines() if is_requirement(line.strip()) ) return list(requirements) @@ -47,64 +47,65 @@ def is_requirement(line): bool: True if the line is not blank, a comment, a URL, or an included file """ return not ( - line == '' or - line.startswith('-r') or - line.startswith('#') or - line.startswith('-e') or - line.startswith('git+') or - line.startswith('-c') + line == "" + or line.startswith("-r") + or line.startswith("#") + or line.startswith("-e") + or line.startswith("git+") + or line.startswith("-c") ) -VERSION = get_version('code_annotations', '__init__.py') +VERSION = get_version("code_annotations", "__init__.py") -if sys.argv[-1] == 'tag': +if sys.argv[-1] == "tag": print("Tagging the version on github:") os.system("git tag -a %s -m 'version %s'" % (VERSION, VERSION)) os.system("git push --tags") sys.exit() -README = open(os.path.join(os.path.dirname(__file__), 'README.rst')).read() -CHANGELOG = open(os.path.join(os.path.dirname(__file__), 'CHANGELOG.rst')).read() +README = open(os.path.join(os.path.dirname(__file__), "README.rst")).read() +CHANGELOG = open(os.path.join(os.path.dirname(__file__), "CHANGELOG.rst")).read() setup( - name='code-annotations', + name="code-annotations", version=VERSION, description="""Extensible tools for parsing annotations in codebases""", - long_description=README + '\n\n' + CHANGELOG, - long_description_content_type='text/x-rst', - author='edX', - author_email='oscm@edx.org', - url='https://github.com/openedx/code-annotations', + long_description=README + "\n\n" + CHANGELOG, + long_description_content_type="text/x-rst", + author="edX", + author_email="oscm@edx.org", + url="https://github.com/openedx/code-annotations", packages=[ - 'code_annotations', + "code_annotations", ], entry_points={ - 'console_scripts': [ - 'code_annotations = code_annotations.cli:entry_point', + "console_scripts": [ + "code_annotations = code_annotations.cli:entry_point", ], - 'annotation_finder.searchers': [ - 'javascript = code_annotations.extensions.javascript:JavascriptAnnotationExtension', - 'python = code_annotations.extensions.python:PythonAnnotationExtension', + "annotation_finder.searchers": [ + "javascript = code_annotations.extensions.javascript:JavascriptAnnotationExtension", + "python = code_annotations.extensions.python:PythonAnnotationExtension", ], }, include_package_data=True, - install_requires=load_requirements('requirements/base.in'), + install_requires=load_requirements("requirements/base.in"), extras_require={"django": ["Django>=4.2"]}, license="Apache Software License 2.0", zip_safe=False, - keywords='edx pii code annotations', + keywords="edx pii code annotations", python_requires=">=3.11", classifiers=[ - 'Development Status :: 3 - Alpha', - 'Framework :: Django', - 'Framework :: Django :: 4.2', - 'Intended Audience :: Developers', - 'License :: OSI Approved :: Apache Software License', - 'Natural Language :: English', - 'Programming Language :: Python', - 'Programming Language :: Python :: 3', - 'Programming Language :: Python :: 3.11', - 'Programming Language :: Python :: 3.12', + "Development Status :: 3 - Alpha", + "Framework :: Django", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.2", + "Intended Audience :: Developers", + "License :: OSI Approved :: Apache Software License", + "Natural Language :: English", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", ], ) diff --git a/tox.ini b/tox.ini index dd9fb64..a36db7c 100644 --- a/tox.ini +++ b/tox.ini @@ -1,5 +1,5 @@ [tox] -envlist = py{311,312}-django{42} +envlist = py{311,312}-django{42,52} [doc8] ignore = D001 @@ -18,6 +18,7 @@ norecursedirs = .* docs requirements [testenv] deps = django42: Django>=4.2,<4.3 + django52: Django>=5.2,<5.3 -r{toxinidir}/requirements/test.txt commands = python -Wd -m pytest {posargs} From c9dbd87f7ba28c625937ead820029e601b4f5ac5 Mon Sep 17 00:00:00 2001 From: Ty Hob Date: Tue, 8 Apr 2025 09:34:55 -0400 Subject: [PATCH 2/2] chore: Bump version to 2.3.0 --- code_annotations/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code_annotations/__init__.py b/code_annotations/__init__.py index 0641294..5b84fa0 100644 --- a/code_annotations/__init__.py +++ b/code_annotations/__init__.py @@ -2,4 +2,4 @@ Extensible tools for parsing annotations in codebases. """ -__version__ = '2.2.0' +__version__ = "2.3.0"