From 4b4e356a8c91f7fecc9af19d2b5e3592d1c66bc6 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sat, 4 Dec 2021 21:03:29 -0500 Subject: [PATCH 01/29] Bump to dev version for merge to main --- src/flake8_absolute_import/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flake8_absolute_import/version.py b/src/flake8_absolute_import/version.py index 157a9e4..e7492de 100644 --- a/src/flake8_absolute_import/version.py +++ b/src/flake8_absolute_import/version.py @@ -21,4 +21,4 @@ """ -__version__ = "1.0.0.1" +__version__ = "1.0.1.dev0" From 18c97a5da14717ad4ed079eaec526826be7bf16c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sat, 4 Dec 2021 21:20:28 -0500 Subject: [PATCH 02/29] Add release date for v1.0.0.1 --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1b7eea..179229d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,7 @@ and this project strives to adhere (mostly) to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -### [1.0.0.1] - ####-##-## +### [1.0.0.1] - 2021-12-04 This is an administrative/metadata release, primarily to update officially supported Python versions. There should be no behavior changes between From f58f235fda9f301c53ccc4d52562bd1bbdb151f1 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 10:35:28 -0600 Subject: [PATCH 03/29] Update setup.cfg Better email, updated classifiers for Python versions --- setup.cfg | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/setup.cfg b/setup.cfg index fea4b50..111b070 100644 --- a/setup.cfg +++ b/setup.cfg @@ -10,7 +10,7 @@ license = MIT License license_file = LICENSE.txt platforms = any author = Brian Skinn -author_email = bskinn@alum.mit.edu +author_email = brian.skinn@gmail.com classifiers = License :: OSI Approved License :: OSI Approved :: MIT License @@ -21,12 +21,11 @@ classifiers = Programming Language :: Python Programming Language :: Python :: 3 Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.6 - Programming Language :: Python :: 3.7 Programming Language :: Python :: 3.8 Programming Language :: Python :: 3.9 Programming Language :: Python :: 3.10 Programming Language :: Python :: 3.11 + Programming Language :: Python :: 3.12 Topic :: Software Development :: Quality Assurance Development Status :: 5 - Production/Stable keywords = flake8-plugin, linting, absolute-imports, relative-imports @@ -35,7 +34,7 @@ keywords = flake8-plugin, linting, absolute-imports, relative-imports install_requires = flake8>=3.7 -python_requires = >=3.4 +python_requires = >=3.6 packages = find: package_dir = =src From 1f2354ae97f9aca615b9a47a10af3a85c3d06b82 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 10:51:26 -0600 Subject: [PATCH 04/29] Update tox testing matrix & doc of supported versions setup.cfg and README Also update README copyright --- README.rst | 4 ++-- setup.cfg | 2 +- tox.ini | 12 +++++------- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/README.rst b/README.rst index 4baf27e..393e0a4 100644 --- a/README.rst +++ b/README.rst @@ -49,13 +49,13 @@ Relative imports raise the ``ABS101`` error code: Available on `PyPI `__ (``pip install flake8-absolute-import``). ``flake8`` should automatically -detect and load the plugin. ``flake8``>=3.7 is required. +detect and load the plugin. ``flake8``>=5.0 is required. Source on `GitHub `__. Bug reports and feature requests are welcomed at the `Issues `__ page there. -Copyright (c) Brian Skinn 2019-2021 +Copyright (c) Brian Skinn 2019-2023 License: The MIT License. See `LICENSE.txt `__ for full license terms. diff --git a/setup.cfg b/setup.cfg index 111b070..fc65da9 100644 --- a/setup.cfg +++ b/setup.cfg @@ -32,7 +32,7 @@ keywords = flake8-plugin, linting, absolute-imports, relative-imports [options] install_requires = - flake8>=3.7 + flake8>=5.0 python_requires = >=3.6 packages = find: diff --git a/tox.ini b/tox.ini index 88d37aa..21e7494 100644 --- a/tox.ini +++ b/tox.ini @@ -2,8 +2,8 @@ minversion=2.0 isolated_build=True envlist= - py3{6,7,8,9,10,11}-f8_{3_7_0,latest} - py3{10}-f8_3_{7_x,8_x,9_x} + py3{7,8,9,10,11,12}-f8_{min,latest} + py3{11,12}-f8_{5_x} sdist_install [testenv] @@ -15,20 +15,18 @@ deps= pytest f8_latest: flake8 - f8_3_7_x: flake8~=3.7.0 - f8_3_7_0: flake8==3.7.0 - f8_3_8_x: flake8~=3.8.0 - f8_3_9_x: flake8~=3.9.0 + f8_min: flake8==5.0 + f8_5_x: flake8~=5.0 [testenv:linux] platform=linux basepython= + py312: python3.12 py311: python3.11 py310: python3.10 py39: python3.9 py38: python3.8 py37: python3.7 - py36: python3.6 [testenv:sdist_install] commands= From f767046e1a13e7e5ce2601e6d90f22020e3c4628 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 10:56:08 -0600 Subject: [PATCH 05/29] Update CI config for new Python versions --- .github/workflows/ci_tests.yml | 10 +++++----- azure-pipelines.yml | 13 ++++++------- 2 files changed, 11 insertions(+), 12 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 805ec67..d2df0fe 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -4,9 +4,9 @@ on: push jobs: all_checks: - name: Run all tests, lints, etc. (Python 3.10) + name: Run all tests, lints, etc. (Python 3.12) runs-on: ubuntu-latest - if: "!contains(github.event.head_commit.message, '[skip ci]')" + if: '!contains(github.event.head_commit.message, "[skip ci]")' steps: - name: Check out repo @@ -15,7 +15,7 @@ jobs: - name: Install Python uses: actions/setup-python@v2 with: - python-version: '3.10' + python-version: '3.12' - name: Update pip & setuptools run: python -m pip install -U pip setuptools @@ -43,8 +43,8 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.6', '3.7', '3.8', '3.9'] - if: "!contains(github.event.head_commit.message, '[skip ci]')" + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] + if: '!contains(github.event.head_commit.message, "[skip ci]")' steps: - name: Check out repo diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9aae50a..fed42c1 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -12,14 +12,16 @@ jobs: - template: azure-coretest.yml parameters: pythons: - py37: - spec: '3.7' py38: spec: '3.8' py39: spec: '3.9' py310: spec: '3.10' + py311: + spec: '3.11' + py312: + spec: '3.12' platforms: [linux, windows, macOs] - job: flake8 @@ -28,14 +30,11 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.10' + versionSpec: '3.12' - script: pip install -U tox displayName: Install tox - - script: pip install -r requirements-flake8.txt - displayName: Install flake8 & plugins - - script: tox -e flake8 displayName: Lint the codebase @@ -45,7 +44,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.10' + versionSpec: '3.12' - script: pip install -r requirements-ci.txt displayName: Install CI requirements From a946dd3dc785fef793145f08e1c47a43363a451b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 10:58:08 -0600 Subject: [PATCH 06/29] Revert VS Code recommended string quoting reformat --- .github/workflows/ci_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index d2df0fe..9a878f3 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -6,7 +6,7 @@ jobs: all_checks: name: Run all tests, lints, etc. (Python 3.12) runs-on: ubuntu-latest - if: '!contains(github.event.head_commit.message, "[skip ci]")' + if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: - name: Check out repo @@ -44,7 +44,7 @@ jobs: strategy: matrix: python: ['3.8', '3.9', '3.10', '3.11', '3.12'] - if: '!contains(github.event.head_commit.message, "[skip ci]")' + if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: - name: Check out repo From f599a9a5135897ae156e1fc4fd326ac313c38f5f Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:00:29 -0600 Subject: [PATCH 07/29] Switch to 3.12 rc Python --- .github/workflows/ci_tests.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 9a878f3..9e0848c 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -4,7 +4,7 @@ on: push jobs: all_checks: - name: Run all tests, lints, etc. (Python 3.12) + name: Run all tests, lints, etc. (Python 3.11) runs-on: ubuntu-latest if: "!contains(github.event.head_commit.message, '[skip ci]')" @@ -15,7 +15,7 @@ jobs: - name: Install Python uses: actions/setup-python@v2 with: - python-version: '3.12' + python-version: '3.11' - name: Update pip & setuptools run: python -m pip install -U pip setuptools @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12.0-rc3'] if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: From 04c84eb97dcfec5792e2448ff55ae3f645d8617b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:01:50 -0600 Subject: [PATCH 08/29] Add curious period to version Why?? --- .github/workflows/ci_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index 9e0848c..aea1cdf 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12.0-rc3'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12.0-rc.3'] if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: From 618fb9ee6025ad0a9987a5af4c5218b411f512f9 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:07:30 -0600 Subject: [PATCH 09/29] Remove 3.12 from Azure Pipelines --- azure-pipelines.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fed42c1..fe49a6e 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,8 +20,6 @@ jobs: spec: '3.10' py311: spec: '3.11' - py312: - spec: '3.12' platforms: [linux, windows, macOs] - job: flake8 @@ -30,7 +28,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.12' + versionSpec: '3.11' - script: pip install -U tox displayName: Install tox @@ -44,7 +42,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.12' + versionSpec: '3.11' - script: pip install -r requirements-ci.txt displayName: Install CI requirements From 68c70ca3aa3bf8010b3e3d615274a26dd5fb937a Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:36:06 -0600 Subject: [PATCH 10/29] Fix pyproject.toml and remove setup.cfg --- pyproject.toml | 90 +++++++++++++++++++++++++++++++++++++++----------- setup.cfg | 47 -------------------------- 2 files changed, 71 insertions(+), 66 deletions(-) delete mode 100644 setup.cfg diff --git a/pyproject.toml b/pyproject.toml index e28a124..8c84316 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,22 +1,74 @@ [build-system] -requires = ["wheel", "setuptools"] +requires = [ + "setuptools>=61.2", +] build-backend = "setuptools.build_meta" -[tool.black] -line-length = 88 -include = ''' -( - ^/tests/.*[.]py$ - | ^/src/flake8_absolute_import/.*[.]py$ - | ^/setup[.]py - | ^/conftest[.]py -) -''' -exclude = ''' -( - __pycache__ - | ^/[.] - | ^/doc - | ^/env -) -''' +[project] +name = "flake8-absolute-import" +description = "flake8 plugin to require absolute imports" +authors = [ + { name = "Brian Skinn", email = "brian.skinn@gmail.com" }, +] +classifiers = [ + "License :: OSI Approved", + "License :: OSI Approved :: MIT License", + "Natural Language :: English", + "Framework :: Flake8", + "Intended Audience :: Developers", + "Operating System :: OS Independent", + "Programming Language :: Python", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3 :: Only", + "Programming Language :: Python :: 3.8", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3.12", + "Topic :: Software Development :: Quality Assurance", + "Development Status :: 5 - Production/Stable", +] +keywords = [ + "flake8-plugin", + "linting", + "absolute-imports", + "relative-imports", +] +requires-python = ">=3.6" +dependencies = [ + "flake8>=5.0", +] +dynamic = [ + "version", + "readme", +] + +[project.urls] +Homepage = "https://github.com/bskinn/flake8-absolute-import" +Changelog = "https://github.com/bskinn/flake8-absolute-import/blob/main/CHANGELOG.md" +Thank = "https://twitter.com/btskinn" +Donate = "https://github.com/sponsors/bskinn" + +[project.license] +text = "MIT License" + +[project.entry-points."flake8.extension"] +ABS1 = "flake8_absolute_import:Plugin" + +[tool.setuptools] +platforms = [ + "any", +] +license-files = [ + "LICENSE.txt", +] +include-package-data = false + +[tool.setuptools.package-dir] +"" = "src" + +[tool.setuptools.packages.find] +where = [ + "src", +] +namespaces = false diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index fc65da9..0000000 --- a/setup.cfg +++ /dev/null @@ -1,47 +0,0 @@ -[metadata] -name = flake8-absolute-import -description = flake8 plugin to require absolute imports -url = https://github.com/bskinn/flake8-absolute-import -project_urls = - Changelog=https://github.com/bskinn/flake8-absolute-import/blob/main/CHANGELOG.md - Thank=https://twitter.com/btskinn - Donate=https://github.com/sponsors/bskinn -license = MIT License -license_file = LICENSE.txt -platforms = any -author = Brian Skinn -author_email = brian.skinn@gmail.com -classifiers = - License :: OSI Approved - License :: OSI Approved :: MIT License - Natural Language :: English - Framework :: Flake8 - Intended Audience :: Developers - Operating System :: OS Independent - Programming Language :: Python - Programming Language :: Python :: 3 - Programming Language :: Python :: 3 :: Only - Programming Language :: Python :: 3.8 - Programming Language :: Python :: 3.9 - Programming Language :: Python :: 3.10 - Programming Language :: Python :: 3.11 - Programming Language :: Python :: 3.12 - Topic :: Software Development :: Quality Assurance - Development Status :: 5 - Production/Stable -keywords = flake8-plugin, linting, absolute-imports, relative-imports - -[options] -install_requires = - flake8>=5.0 - -python_requires = >=3.6 -packages = find: -package_dir = - =src - -[options.packages.find] -where = src - -[options.entry_points] -flake8.extension = - ABS1=flake8_absolute_import:Plugin From 9a89d6ac827d78880cb5924349aecadcc6dc8dc0 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:38:11 -0600 Subject: [PATCH 11/29] Modernize setup.py - Explicit set of __version__ - Path(...).read_text() instead of open() - Refactor str.format() to f-strings --- setup.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/setup.py b/setup.py index 2d91920..ed30809 100644 --- a/setup.py +++ b/setup.py @@ -3,18 +3,19 @@ from setuptools import find_packages, setup -with Path("src", "flake8_absolute_import", "version.py").open() as f: - exec(f.read()) +exec_ns = {} +exec( + Path("src", "flake8_absolute_import", "version.py").read_text(encoding="utf-8"), + exec_ns, +) +__version__ = exec_ns["__version__"] NAME = "flake8-absolute-import" - - version_override = None def readme(): - with open("README.rst", "r") as f: - content = f.read() + content = Path("README.rst").read_text() new_ver = version_override if version_override else __version__ @@ -25,19 +26,18 @@ def content_update(content, pattern, sub): # Docs reference updates to current release version, for PyPI # This one gets the badge image content = content_update( - content, r"(?<=/readthedocs/{0}/)\S+?(?=\.svg$)".format(NAME), "v" + new_ver + content, rf"(?<=/readthedocs/{NAME}/)\S+?(?=\.svg$)", "v" + new_ver ) # This one gets the RtD links content = content_update( - content, r"(?<={0}\.readthedocs\.io/en/)\S+?(?=/)".format(NAME), "v" + new_ver + content, rf"(?<={NAME}\.readthedocs\.io/en/)\S+?(?=/)", "v" + new_ver ) return content setup( - name=NAME, version=__version__, long_description=readme(), long_description_content_type="text/x-rst", From 186708882e1426f173b3f7aae9421117eead87f1 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:50:16 -0600 Subject: [PATCH 12/29] Restore accidentally obliterated pyproject bits Overwrote instead of dumping to a new, test file. :-( --- pyproject.toml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/pyproject.toml b/pyproject.toml index 8c84316..d19ef3b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,5 +1,6 @@ [build-system] requires = [ + "wheel", "setuptools>=61.2", ] build-backend = "setuptools.build_meta" @@ -72,3 +73,22 @@ where = [ "src", ] namespaces = false + +[tool.black] +line-length = 88 +include = ''' +( + ^tests/.*[.]py$ + | ^src/flake8_absolute_import/.*[.]py$ + | ^setup[.]py + | ^conftest[.]py +) +''' +exclude = ''' +( + __pycache__ + | ^[.] + | ^doc + | ^env +) +''' From b781b272d054e840d8f4cfafdbd8303839a1831d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:51:50 -0600 Subject: [PATCH 13/29] Refactor test code to improve some names --- tests/test_plugin.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index a206235..5809016 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -29,14 +29,14 @@ from flake8_absolute_import import Plugin -def is_relative(s): - """Indicate if a given 'from s' import location is a relative import.""" - return s.startswith(".") +def is_relative(import_source): + """Indicate if a given 'from {source}' import location is a relative import.""" + return import_source.startswith(".") -def format_id(i): +def format_id(id_): """Provide parametrization id formatting for the given id.""" - return "{0} (expect {1}error)".format(i, "" if is_relative(i) else "no ") + return f"{id_} (expect {'' if is_relative(id_) else 'no '}error)" @pytest.mark.parametrize("code", ["import sys", "import flake8_absolute_import"]) From 0e423a5146ac63401a81c3611a56da24185246db Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 11:52:16 -0600 Subject: [PATCH 14/29] Refactor .format()s to f-strings in test module --- tests/test_plugin.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 5809016..4db5ca4 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -106,11 +106,11 @@ def test_multilevel_relative_import(): def test_func_imports(impfrom): """Confirm plugin works for imports in functions.""" code = dedent( - """ + f""" def func(): - from {} import foo + from {impfrom} import foo """ - ).format(impfrom) + ) tree = ast.parse(code) assert (len(list(Plugin(tree).run())) == 1) == (impfrom.startswith(".")) @@ -120,11 +120,11 @@ def func(): def test_class_imports(impfrom): """Confirm plugin works for imports in class bodies.""" code = dedent( - """ + f""" class Bar: - from {} import foo + from {impfrom} import foo """ - ).format(impfrom) + ) tree = ast.parse(code) assert (len(list(Plugin(tree).run())) == 1) == (impfrom.startswith(".")) @@ -134,12 +134,12 @@ class Bar: def test_method_imports(impfrom): """Confirm plugin works for imports in class methods.""" code = dedent( - """ + f""" class Bar: def baz(self): - from {} import foo + from {impfrom} import foo """ - ).format(impfrom) + ) tree = ast.parse(code) assert (len(list(Plugin(tree).run())) == 1) == (impfrom.startswith(".")) From 7d2bfa51d3132986536c6ca57a849e6a7286827b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 17:58:23 -0600 Subject: [PATCH 15/29] Add CI for testable sdist & augment MANIFEST.in --- MANIFEST.in | 3 +- azure-pipelines.yml | 2 ++ azure-sdisttest.yml | 73 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 77 insertions(+), 1 deletion(-) create mode 100644 azure-sdisttest.yml diff --git a/MANIFEST.in b/MANIFEST.in index de0a14a..8606d0b 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1 +1,2 @@ -include LICENSE.txt README.rst CHANGELOG.md pyproject.toml +include AUTHORS.md LICENSE.txt README.rst CHANGELOG.md pyproject.toml +include requirements-dev.txt requirements-flake8.txt tox.ini diff --git a/azure-pipelines.yml b/azure-pipelines.yml index fe49a6e..9b65f92 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,6 +22,8 @@ jobs: spec: '3.11' platforms: [linux, windows, macOs] +- template: azure-sdisttest.yml + - job: flake8 pool: vmImage: 'Ubuntu-latest' diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml new file mode 100644 index 0000000..422881b --- /dev/null +++ b/azure-sdisttest.yml @@ -0,0 +1,73 @@ +jobs: +- job: testable_sdist + displayName: Ensure sdist is testable + + variables: + pip_cache_dir: $(Pipeline.Workspace)/.pip + + pool: + vmImage: 'Ubuntu-latest' + + steps: + - task: UsePythonVersion@0 + inputs: + versionSpec: '3.10' + + - task: Cache@2 + inputs: + key: 'pip | "$(Agent.OS)" | requirements-dev.txt | requirements-flake8.txt' + restoreKeys: | + pip | "$(Agent.OS)" + path: $(pip_cache_dir) + displayName: Cache pip + + - script: python -m pip install build + displayName: Install 'build' package + + - script: | + python -m build -s + ls -lah dist + displayName: Build sdist + + - script: | + mkdir sandbox + displayName: Create sandbox + + - script: | + cp dist/*.gz sandbox/ + cd sandbox + tar xvf *.gz + displayName: Unpack sdist in sandbox + + - script: | + cd sandbox + python -m venv env + displayName: Create venv + + # Only the dir of the unpacked sdist will have a digit in its name + - script: | + cd sandbox + echo $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + displayName: Check unpack dir name + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + python -m pip install -r requirements-dev.txt + displayName: Install dev req'ts to venv + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + cd doc + O=-Ean make html + displayName: Build docs in sandbox + + - script: | + cd sandbox + source env/bin/activate + cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) + pytest --nonloc + displayName: Run test suite in sandbox From 62ee1b367cfbb6ada4b63323464e55c4a0c5c197 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 18:02:15 -0600 Subject: [PATCH 16/29] Skip docs build in sdist test since there are none --- azure-sdisttest.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml index 422881b..af5e8b9 100644 --- a/azure-sdisttest.yml +++ b/azure-sdisttest.yml @@ -63,7 +63,8 @@ jobs: cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) cd doc O=-Ean make html - displayName: Build docs in sandbox + displayName: Build docs in sandbox (skipped, no docs) + if: false - script: | cd sandbox From bedfc8cfbed365842183b551344e038da462621a Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 18:08:31 -0600 Subject: [PATCH 17/29] Fix Azure syntax --- azure-sdisttest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml index af5e8b9..d25dddf 100644 --- a/azure-sdisttest.yml +++ b/azure-sdisttest.yml @@ -64,7 +64,7 @@ jobs: cd doc O=-Ean make html displayName: Build docs in sandbox (skipped, no docs) - if: false + condition: false - script: | cd sandbox From 8b36d8822e2ed54480fb156313227a69deb89458 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 1 Oct 2023 18:12:24 -0600 Subject: [PATCH 18/29] Remove leftover sphobjinv test flag --- azure-sdisttest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml index d25dddf..933fe90 100644 --- a/azure-sdisttest.yml +++ b/azure-sdisttest.yml @@ -70,5 +70,5 @@ jobs: cd sandbox source env/bin/activate cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" ) - pytest --nonloc + pytest displayName: Run test suite in sandbox From 6dcd348e698e7bf8d0e317e7ff235a7e91c3fb56 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 11:44:29 -0400 Subject: [PATCH 19/29] Add trial bumps to unqualified Python 3.12 --- .github/workflows/ci_tests.yml | 3 +-- azure-pipelines.yml | 2 ++ azure-sdisttest.yml | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci_tests.yml b/.github/workflows/ci_tests.yml index aea1cdf..d0593d4 100644 --- a/.github/workflows/ci_tests.yml +++ b/.github/workflows/ci_tests.yml @@ -43,7 +43,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: ['3.8', '3.9', '3.10', '3.11', '3.12.0-rc.3'] + python: ['3.8', '3.9', '3.10', '3.11', '3.12'] if: "!contains(github.event.head_commit.message, '[skip ci]')" steps: @@ -68,4 +68,3 @@ jobs: run: | pytest --cov tox -e sdist_install - \ No newline at end of file diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 9b65f92..910ca23 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -20,6 +20,8 @@ jobs: spec: '3.10' py311: spec: '3.11' + py312: + spec: '3.12' platforms: [linux, windows, macOs] - template: azure-sdisttest.yml diff --git a/azure-sdisttest.yml b/azure-sdisttest.yml index 933fe90..9f7e2a3 100644 --- a/azure-sdisttest.yml +++ b/azure-sdisttest.yml @@ -11,7 +11,7 @@ jobs: steps: - task: UsePythonVersion@0 inputs: - versionSpec: '3.10' + versionSpec: '3.11' - task: Cache@2 inputs: From 8449975ac4c721923949e79ae2340a6027b01616 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 20:08:01 -0400 Subject: [PATCH 20/29] Fix flake8 in tox Only need to lint the code in one environment. --- tox.ini | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tox.ini b/tox.ini index 21e7494..1334960 100644 --- a/tox.ini +++ b/tox.ini @@ -5,12 +5,12 @@ envlist= py3{7,8,9,10,11,12}-f8_{min,latest} py3{11,12}-f8_{5_x} sdist_install + flake8 [testenv] commands= - pytest flake8 --version - flake8 tests + pytest deps= pytest From 9bc8cb7ae422f1e427f3815ea05aadde4488b43d Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 20:41:20 -0400 Subject: [PATCH 21/29] Update copyright dates and contact email --- LICENSE.txt | 2 +- src/flake8_absolute_import/__init__.py | 4 ++-- src/flake8_absolute_import/core.py | 4 ++-- src/flake8_absolute_import/version.py | 4 ++-- tests/test_plugin.py | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/LICENSE.txt b/LICENSE.txt index 7f9d634..3742dc3 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2019-2021 Brian Skinn +Copyright (c) 2019-2023 Brian Skinn Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/src/flake8_absolute_import/__init__.py b/src/flake8_absolute_import/__init__.py index 808ebb0..5fe1ff3 100644 --- a/src/flake8_absolute_import/__init__.py +++ b/src/flake8_absolute_import/__init__.py @@ -3,13 +3,13 @@ flake8 plugin to require absolute imports **Author** - Brian Skinn (bskinn@alum.mit.edu) + Brian Skinn (brian.skinn@gmail.com) **File Created** 6 Sep 2019 **Copyright** - \(c) Brian Skinn 2019-2021 + \(c) Brian Skinn 2019-2023 **Source Repository** http://github.com/bskinn/flake8-absolute-import diff --git a/src/flake8_absolute_import/core.py b/src/flake8_absolute_import/core.py index 1073dbf..63ba5a2 100644 --- a/src/flake8_absolute_import/core.py +++ b/src/flake8_absolute_import/core.py @@ -3,13 +3,13 @@ flake8 plugin to require absolute imports **Author** - Brian Skinn (bskinn@alum.mit.edu) + Brian Skinn (brian.skinn@gmail.com) **File Created** 6 Sep 2019 **Copyright** - \(c) Brian Skinn 2019-2021 + \(c) Brian Skinn 2019-2023 **Source Repository** http://github.com/bskinn/flake8-absolute-import diff --git a/src/flake8_absolute_import/version.py b/src/flake8_absolute_import/version.py index e7492de..0ef6626 100644 --- a/src/flake8_absolute_import/version.py +++ b/src/flake8_absolute_import/version.py @@ -3,13 +3,13 @@ flake8 plugin to require absolute imports **Author** - Brian Skinn (bskinn@alum.mit.edu) + Brian Skinn (brian.skinn@gmail.com) **File Created** 6 Sep 2019 **Copyright** - \(c) Brian Skinn 2019-2021 + \(c) Brian Skinn 2019-2023 **Source Repository** http://github.com/bskinn/flake8-absolute-import diff --git a/tests/test_plugin.py b/tests/test_plugin.py index 4db5ca4..ed24f3c 100644 --- a/tests/test_plugin.py +++ b/tests/test_plugin.py @@ -3,13 +3,13 @@ flake8 plugin to require absolute imports **Author** - Brian Skinn (bskinn@alum.mit.edu) + Brian Skinn (brian.skinn@gmail.com) **File Created** 6 Sep 2019 **Copyright** - \(c) Brian Skinn 2019-2021 + \(c) Brian Skinn 2019-2023 **Source Repository** http://github.com/bskinn/flake8-absolute-import From 81d7fa65dc909a6a2de5e5e0f8adeaf23b10d79c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 20:41:38 -0400 Subject: [PATCH 22/29] Add CC-BY to license blurb --- README.rst | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index 393e0a4..8b31553 100644 --- a/README.rst +++ b/README.rst @@ -57,8 +57,13 @@ and feature requests are welcomed at the Copyright (c) Brian Skinn 2019-2023 -License: The MIT License. See `LICENSE.txt `__ -for full license terms. +The ``flake8-absolute-import`` documentation (including docstrings and README) +is licensed under a +`Creative Commons Attribution 4.0 International License `__ +(CC-BY). The ``flake8-absolute-import`` codebase is released under the +`MIT License `__. See +`LICENSE.txt `__ for +full license terms. .. _ImportFrom: https://greentreesnakes.readthedocs.io/en/latest/nodes.html#ImportFrom .. |ImportFrom| replace:: ``ImportFrom`` From 75ae3a4e7843f84b202dcbfdb4bc8a15f3b710a4 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 21:41:16 -0400 Subject: [PATCH 23/29] Switch version def from setup.py to pyproject.toml --- pyproject.toml | 3 +++ setup.py | 1 - 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index d19ef3b..cbc890c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -65,6 +65,9 @@ license-files = [ ] include-package-data = false +[tool.setuptools.dynamic] +version = {attr = "flake8_absolute_import.version.__version__"} + [tool.setuptools.package-dir] "" = "src" diff --git a/setup.py b/setup.py index ed30809..19adc57 100644 --- a/setup.py +++ b/setup.py @@ -38,7 +38,6 @@ def content_update(content, pattern, sub): setup( - version=__version__, long_description=readme(), long_description_content_type="text/x-rst", ) From 67d25ccc478a4899a91b984e906e4478c97b4c4b Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 21:43:44 -0400 Subject: [PATCH 24/29] Bump version to 1.0.0.2 --- src/flake8_absolute_import/version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/flake8_absolute_import/version.py b/src/flake8_absolute_import/version.py index 0ef6626..50b0805 100644 --- a/src/flake8_absolute_import/version.py +++ b/src/flake8_absolute_import/version.py @@ -21,4 +21,4 @@ """ -__version__ = "1.0.1.dev0" +__version__ = "1.0.0.2" From f4c38aabebf9fc9a906a272ba5f2713a4139240c Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 21:48:35 -0400 Subject: [PATCH 25/29] Adjust README wording --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 8b31553..ada254b 100644 --- a/README.rst +++ b/README.rst @@ -33,7 +33,7 @@ flake8-absolute-import Lint 'em out! -``flake8-absolute-import`` uses a simple check of the AST for each +``flake8-absolute-import`` uses a direct check of the AST for each ``from x import y`` statement to flag relative imports. Specifically, it checks for a nonzero *level* attribute on each |ImportFrom|_ node. From 0a8592c9733a1d48783b0b9d1cbc04edeace87cb Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 21:55:23 -0400 Subject: [PATCH 26/29] Fix for shields.io breaking change Per https://github.com/badges/shields/issues/8671 --- README.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.rst b/README.rst index ada254b..769ceec 100644 --- a/README.rst +++ b/README.rst @@ -5,7 +5,7 @@ flake8-absolute-import **Current Development Version:** -.. image:: https://img.shields.io/github/workflow/status/bskinn/flake8-absolute-import/ci-tests?logo=github +.. image:: https://img.shields.io/github/actions/workflow/status/bskinn/flake8-absolute-import/ci_tests.yml?branch=main&logo=github :alt: GitHub Workflow Status :target: https://github.com/bskinn/flake8-absolute-import/actions From 2cabad04eda5f5958a0d577a318d20200f1f0fef Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 22:02:42 -0400 Subject: [PATCH 27/29] Add pepy.tech downloads badge --- README.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.rst b/README.rst index 769ceec..7044895 100644 --- a/README.rst +++ b/README.rst @@ -27,6 +27,9 @@ flake8-absolute-import .. image:: https://img.shields.io/badge/code%20style-black-000000.svg :target: https://github.com/psf/black +.. image:: https://pepy.tech/badge/flake8-absolute-import/month + :target: https://pepy.tech/project/flake8-absolute-import + ---- *Don't like relative imports?* From aeff008d4e4174a18b5a465cbfe0895ea4439013 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 22:38:33 -0400 Subject: [PATCH 28/29] Update CHANGELOG --- CHANGELOG.md | 64 +++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 51 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 179229d..ed90d11 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,44 @@ and this project strives to adhere (mostly) to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). +### [1.0.0.2] - 2023-10-08 + +This is an administrative release, primarily to update officially supported +Python and flake8 versions. There should be no plugin behavior changes between +this version and v1.0.0.1. + +#### Dependencies + +- Support for Python 3.12 was officially added + +- Support for Python 3.6 and 3.7 was officially removed, though the plugin + should continue to work for Python 3.6+ + +- The minimum supported flake8 version is now 5.0 + +#### Administrative + +- `MANIFEST.in` was augmented with the files needed to allow the test suite to + run from an unpacked sdist. + +- The build metadata was completely migrated from `setup.cfg` to + `pyproject.toml`, and the maximum possible metadata is now drawn from + `pyproject.toml` (all but `long_description`). + +- The read of the project version and the load of the README contents in + `setup.py` was modernized/improved. + +#### Testing + +- Python versions in the GitHub Actions and Azure Pipelines matrices were updated. + +- An Azure Pipelines job was added to confirm that a built sdist carries all the + files needed to allow the test suite to run. + +- Obscure parameters/variables in some tests were given better names, and string + formatting was upgraded to use f-strings. + + ### [1.0.0.1] - 2021-12-04 This is an administrative/metadata release, primarily to update officially @@ -15,36 +53,36 @@ this version and v1.0.0. #### Dependencies -- Support for Python 3.10 and 3.11-dev was officially added +- Support for Python 3.10 and 3.11-dev was officially added. -- Support for Python 3.5 was officially removed, though the plugin should - remain compatible +- Support for Python 3.5 was officially removed, though the plugin should remain + compatible. #### Testing -- Support for running the `tox` matrix on Windows was removed (it doesn't - seem to work right with the batch-files-in-bin-folder approach I use for - multiple Pythons in development) +- Support for running the `tox` matrix on Windows was removed (it doesn't seem + to work right with the batch-files-in-bin-folder approach I use for multiple + Pythons in development). -- Routine CI switched from Travis CI to GitHub Actions +- Routine CI was switched from Travis CI to GitHub Actions. -- CI and `tox` versions updated to focus on Python 3.10 +- CI and `tox` versions were updated to focus on Python 3.10. -- `pytest` and `coverage` configs revised to avoid `source`/`include` collision - in `coverage` +- `pytest` and `coverage` configs were revised to avoid `source`/`include` + collision in `coverage`. #### Administrative - `setuptools` configuration has been mostly ported to `setup.cfg`, except for the - pieces that still need to be defined dynamically + pieces that still need to be defined dynamically. - Built artifacts for distribution should now be created using `build`, which - has been added to `requirements-dev.txt` + has been added to `requirements-dev.txt`. ### [1.0.0] - 2019-09-09 #### Features -- Detect any relative imports and report with error code ABS101 +- Detect any relative imports and report with error code ABS101. From 0e7abd1ff9e10d614f45216003e58606149a7db3 Mon Sep 17 00:00:00 2001 From: Brian Skinn Date: Sun, 8 Oct 2023 22:39:12 -0400 Subject: [PATCH 29/29] Reflow AUTHORS.md --- AUTHORS.md | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/AUTHORS.md b/AUTHORS.md index 11ef574..24aebe9 100644 --- a/AUTHORS.md +++ b/AUTHORS.md @@ -1,8 +1,16 @@ Credits ======= -`flake8-absolute-import` is authored and maintained by Brian Skinn ([Blog](https://bskinn.github.io)) ([Twitter](https://twitter.com/btskinn)). The skeleton of the AST-based implementation used for this plugin was shamelessly swiped from [`flake8-2020`](https://github.com/asottile/flake8-2020) by [Anthony Sottile](https://github.com/asottile). +`flake8-absolute-import` is authored and maintained by Brian Skinn +([Blog](https://bskinn.github.io)) ([Twitter](https://twitter.com/btskinn)). The +skeleton of the AST-based implementation used for this plugin was shamelessly +swiped from [`flake8-2020`](https://github.com/asottile/flake8-2020) by +[Anthony Sottile](https://github.com/asottile). -While there is disagreement about the upsides and downsides of relative imports in Python, as best this author can tell there are numerous projects and developers out there who desire to hold strictly to absolute imports in their code. The goal of this flake8 plugin is to simplify enforcement of this policy. +While there is disagreement about the upsides and downsides of relative imports +in Python, as best this author can tell there are numerous projects and +developers out there who desire to hold strictly to absolute imports in their +code. The goal of this flake8 plugin is to simplify enforcement of this policy. -v1.0 provides a single catch-all error, `ABS101`, raised on any relative imports found. +v1.0 provides a single catch-all error, `ABS101`, raised on any relative imports +found.