Skip to content

Commit d869275

Browse files
authored
Drop Python 3.9 Support (#184)
1 parent b6857f6 commit d869275

File tree

9 files changed

+236
-317
lines changed

9 files changed

+236
-317
lines changed

.github/workflows/lint_test.yml

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,18 @@ jobs:
1515
steps:
1616
- uses: actions/checkout@v4
1717

18+
- name: Set up Python
19+
uses: actions/setup-python@v6
20+
with:
21+
python-version-file: "pyproject.toml"
22+
1823
- name: Install uv
1924
uses: astral-sh/setup-uv@v6
2025
with:
2126
version: "0.8.x"
2227
enable-cache: true
2328
cache-dependency-glob: "uv.lock"
2429

25-
- name: Set up Python
26-
uses: actions/setup-python@v5
27-
with:
28-
python-version-file: "pyproject.toml"
29-
3030
- name: Install dependencies
3131
run: uv sync --all-extras --dev
3232

@@ -38,21 +38,19 @@ jobs:
3838
runs-on: ubuntu-latest
3939
strategy:
4040
matrix:
41-
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13", "3.14-dev"]
41+
python-version: ["3.10", "3.11", "3.12", "3.13", "3.14-dev"]
4242
fail-fast: false
4343

4444
steps:
4545
- uses: actions/checkout@v4
4646

47-
- name: Install uv
48-
uses: astral-sh/setup-uv@v6
49-
with:
50-
version: "0.8.x"
51-
enable-cache: true
52-
cache-dependency-glob: "uv.lock"
47+
- name: Get Non-Hyphenated Python Version
48+
id: get-pyver
49+
run: |
50+
echo "PYVER=$(cut -d '-' -f 1 <<< ${{ matrix.python-version }})" >> $GITHUB_OUTPUT
5351
5452
- name: Set up (release) Python ${{ matrix.python-version }}
55-
uses: actions/setup-python@v5
53+
uses: actions/setup-python@v6
5654
if: "!endsWith(matrix.python-version, '-dev')"
5755
with:
5856
python-version: ${{ matrix.python-version }}
@@ -63,13 +61,21 @@ jobs:
6361
with:
6462
python-version: ${{ matrix.python-version }}
6563

64+
- name: Install uv
65+
uses: astral-sh/setup-uv@v6
66+
with:
67+
version: "0.8.x"
68+
enable-cache: true
69+
cache-dependency-glob: "uv.lock"
70+
6671
- name: Install dependencies
6772
run: |
68-
uv venv
69-
uv pip install tox-gh-actions tox-uv
73+
uv venv --python ${{ steps.get-pyver.outputs.PYVER }}
74+
uv pip install tox-uv
7075
7176
- name: Run tests w/tox
72-
run: uv run tox
77+
run: |
78+
uv run tox -e ${{ steps.get-pyver.outputs.PYVER }}
7379
7480
- name: Cache coverage for ${{ matrix.python-version }}
7581
uses: actions/upload-artifact@v4
@@ -87,7 +93,7 @@ jobs:
8793
- uses: actions/checkout@v4
8894

8995
- name: Set up Python
90-
uses: actions/setup-python@v5
96+
uses: actions/setup-python@v6
9197
with:
9298
python-version-file: "pyproject.toml"
9399

.github/workflows/pypi_release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ jobs:
2626
cache-dependency-glob: "uv.lock"
2727

2828
- name: Set up Python
29-
uses: actions/setup-python@v5
29+
uses: actions/setup-python@v6
3030
with:
3131
python-version-file: "pyproject.toml"
3232

3333
- name: Build package
3434
run: uv build
3535

3636
- name: Publish to PyPI
37-
uses: pypa/gh-action-pypi-publish@release/v1.10
37+
uses: pypa/gh-action-pypi-publish@release/v1.13
3838
with:
3939
print-hash: true
4040

.pre-commit-config.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repos:
1313
- id: isort
1414
name: isort
1515
- repo: https://github.com/pre-commit/pre-commit-hooks
16-
rev: v5.0.0
16+
rev: v6.0.0
1717
hooks:
1818
- id: check-merge-conflict
1919
- id: check-toml
@@ -27,7 +27,7 @@ repos:
2727
- id: python-check-blanket-type-ignore
2828
exclude: "test_type_ignore.py"
2929
- repo: https://github.com/astral-sh/ruff-pre-commit
30-
rev: v0.12.7
30+
rev: v0.12.12
3131
hooks:
3232
- id: ruff-check
3333
- repo: local

CONTRIBUTING.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Contributing
2+
## Python Version Support
3+
A best attempt is made to support Python versions until they reach EOL, after which support will be formally dropped by the next minor or major release of this package, whichever arrives first. The status of Python versions can be found [here](https://devguide.python.org/versions/).
4+
5+
## Development Environment
6+
7+
Development of this project is done using the supported Python version most recently released. Note that tests are run against all supported versions of Python; see: [Testing & Coverage](#testing--coverage) for additional information.
8+
9+
This project uses [uv](https://docs.astral.sh/uv) to manage dependencies. With your fork cloned to your local machine, you can install the project and its dependencies to create a development environment using:
10+
11+
```text
12+
$ uv venv
13+
$ uv sync --all-extras --dev
14+
```
15+
16+
A [`pre-commit`](https://pre-commit.com) configuration is also provided to create a pre-commit hook so linting errors aren't committed:
17+
18+
```text
19+
$ pre-commit install
20+
```
21+
22+
[`mypy`](https://mypy-lang.org/) is also used by this project to provide static type checking. It can be invoked using:
23+
24+
```text
25+
$ mypy .
26+
```
27+
28+
Note that `mypy` is not included as a pre-commit hook.
29+
30+
## Testing & Coverage
31+
32+
A [pytest](https://docs.pytest.org/en/latest/) suite is provided, with coverage reporting from [`pytest-cov`](https://github.com/pytest-dev/pytest-cov). A [`tox`](https://github.com/tox-dev/tox/) configuration is provided to test across all supported versions of Python. Testing will be skipped locally for Python versions that cannot be found; all supported versions are tested in CI.
33+
34+
```text
35+
$ tox
36+
```
37+
38+
Details on missing coverage, including in the test suite, is provided in the report to allow the user to generate additional tests for full coverage. Full code coverage is expected for the majority of code contributed to this project. Some exceptions are expected, primarily around code whose functionality relies on either user input or the presence of external drives; these interactions are currently not mocked, though this may change in the future.

README.md

Lines changed: 0 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -206,31 +206,3 @@ Support is only provided for the following patterns:
206206
* `import typing as <alias>; foo: <alias>.Any`
207207

208208
Nested dynamic types (e.g. `typing.Tuple[typing.Any]`) and redefinition (e.g. `from typing import Any as Foo`) will not be identified.
209-
210-
## Contributing
211-
### Python Version Support
212-
A best attempt is made to support Python versions until they reach EOL, after which support will be formally dropped by the next minor or major release of this package, whichever arrives first. The status of Python versions can be found [here](https://devguide.python.org/versions/).
213-
214-
### Development Environment
215-
This project uses [Poetry](https://python-poetry.org/) to manage dependencies. With your fork cloned to your local machine, you can install the project and its dependencies to create a development environment using:
216-
217-
```bash
218-
$ poetry install
219-
```
220-
221-
Note: An editable installation of `flake8-annotations` in the developer environment is required in order for the plugin to be registered for Flake8. By default, Poetry includes an editable install of the project itself when `poetry install` is invoked.
222-
223-
A [pre-commit](https://pre-commit.com) configuration is also provided to create a pre-commit hook so linting errors aren't committed:
224-
225-
```bash
226-
$ pre-commit install
227-
```
228-
229-
### Testing & Coverage
230-
A [pytest](https://docs.pytest.org/en/latest/) suite is provided, with coverage reporting from [pytest-cov](https://github.com/pytest-dev/pytest-cov). A [tox](https://github.com/tox-dev/tox/) configuration is provided to test across all supported versions of Python. Testing will be skipped for Python versions that cannot be found.
231-
232-
```bash
233-
$ tox
234-
```
235-
236-
Details on missing coverage, including in the test suite, is provided in the report to allow the user to generate additional tests for full coverage.

flake8_annotations/ast_walker.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
import ast
44
import typing as t
5-
6-
from attrs import define
5+
from dataclasses import dataclass
76

87
from flake8_annotations.enums import AnnotationType, ClassDecoratorType, FunctionType
98

@@ -16,7 +15,7 @@
1615
AST_ARG_TYPES: t.Tuple[str, ...] = ("posonlyargs", "args", "vararg", "kwonlyargs", "kwarg")
1716

1817

19-
@define(slots=True)
18+
@dataclass(slots=True)
2019
class Argument:
2120
"""Represent a function argument & its metadata."""
2221

@@ -74,7 +73,7 @@ def _is_annotated_any(arg_expr: ast.expr) -> bool:
7473
return False
7574

7675

77-
@define(slots=True)
76+
@dataclass(slots=True)
7877
class Function:
7978
"""
8079
Represent a function and its relevant metadata.

pyproject.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ classifiers = [
1717
"Development Status :: 6 - Mature",
1818
"Programming Language :: Python",
1919
"Programming Language :: Python :: 3",
20-
"Programming Language :: Python :: 3.9",
2120
"Programming Language :: Python :: 3.10",
2221
"Programming Language :: Python :: 3.11",
2322
"Programming Language :: Python :: 3.12",
@@ -29,9 +28,8 @@ classifiers = [
2928
"Typing :: Typed",
3029
]
3130

32-
requires-python = ">=3.9"
31+
requires-python = ">=3.10"
3332
dependencies = [
34-
"attrs~=25.0",
3533
"flake8>=5.0",
3634
]
3735

tox.ini

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,11 @@ exclude_lines =
1515
if TYPE_CHECKING:
1616

1717
[tox]
18-
envlist = clean,py{39,310,311,312,313,314},cog
18+
envlist = clean,py{3.10,3.11,3.12,3.13,3.14},cog
1919
skip_missing_interpreters = True
20-
minversion = 4.0.0
2120
isolated_build = True
21+
requires =
22+
tox >= 4.0
2223

2324
[testenv]
2425
commands = python -m pytest
@@ -38,14 +39,4 @@ commands = coverage erase
3839
commands = cog -r README.md
3940
deps =
4041
cogapp
41-
attrs
4242
flake8
43-
44-
[gh-actions] # For tox GHA
45-
python =
46-
3.9: py39
47-
3.10: py310
48-
3.11: py311
49-
3.12: py312
50-
3.13: py313
51-
3.14: py314

0 commit comments

Comments
 (0)