Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Freshen requirements, docs, etc. for Python 3.12 release #19

Merged
merged 17 commits into from
Oct 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions .github/workflows/ci_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: push

jobs:
all_checks:
name: Run all tests, lints, etc. (Python 3.10)
name: Run all tests, lints, etc. (Python 3.11)
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '[skip ci]')"

Expand All @@ -15,7 +15,7 @@ jobs:
- name: Install Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
python-version: '3.11'

- name: Update pip & setuptools
run: python -m pip install -U pip setuptools
Expand Down Expand Up @@ -43,7 +43,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python: ['3.6', '3.7', '3.8', '3.9']
python: ['3.8', '3.9', '3.10', '3.11', '3.12']
if: "!contains(github.event.head_commit.message, '[skip ci]')"

steps:
Expand All @@ -68,4 +68,3 @@ jobs:
run: |
pytest --cov
tox -e sdist_install

3 changes: 2 additions & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -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
4 changes: 2 additions & 2 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@ Relative imports raise the ``ABS101`` error code:

Available on `PyPI <https://pypi.python.org/pypi/flake8-absolute-import>`__
(``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 <https://github.com/bskinn/flake8-absolute-import>`__. Bug reports
and feature requests are welcomed at the
`Issues <https://github.com/bskinn/flake8-absolute-import/issues>`__ page there.

Copyright (c) Brian Skinn 2019-2021
Copyright (c) Brian Skinn 2019-2023

License: The MIT License. See `LICENSE.txt <https://github.com/bskinn/flake8-absolute-import/blob/main/LICENSE.txt>`__
for full license terms.
Expand Down
15 changes: 8 additions & 7 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,31 @@ 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]

- template: azure-sdisttest.yml

- job: flake8
pool:
vmImage: 'Ubuntu-latest'
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
versionSpec: '3.11'

- 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

Expand All @@ -45,7 +46,7 @@ jobs:
steps:
- task: UsePythonVersion@0
inputs:
versionSpec: '3.10'
versionSpec: '3.11'

- script: pip install -r requirements-ci.txt
displayName: Install CI requirements
Expand Down
74 changes: 74 additions & 0 deletions azure-sdisttest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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.11'

- 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 (skipped, no docs)
condition: false

- script: |
cd sandbox
source env/bin/activate
cd $( find . -maxdepth 1 -type d -regex "./.+[0-9].+" )
pytest
displayName: Run test suite in sandbox
88 changes: 80 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,22 +1,94 @@
[build-system]
requires = ["wheel", "setuptools"]
requires = [
"wheel",
"setuptools>=61.2",
]
build-backend = "setuptools.build_meta"

[project]
name = "flake8-absolute-import"
description = "flake8 plugin to require absolute imports"
authors = [
{ name = "Brian Skinn", email = "[email protected]" },
]
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

[tool.black]
line-length = 88
include = '''
(
^/tests/.*[.]py$
| ^/src/flake8_absolute_import/.*[.]py$
| ^/setup[.]py
| ^/conftest[.]py
^tests/.*[.]py$
| ^src/flake8_absolute_import/.*[.]py$
| ^setup[.]py
| ^conftest[.]py
)
'''
exclude = '''
(
__pycache__
| ^/[.]
| ^/doc
| ^/env
| ^[.]
| ^doc
| ^env
)
'''
48 changes: 0 additions & 48 deletions setup.cfg

This file was deleted.

18 changes: 9 additions & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__

Expand All @@ -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",
Expand Down
Loading
Loading