Skip to content

Commit 3a908cd

Browse files
committed
Use dependency groups & a fully locked dev environment
1 parent c17b1f3 commit 3a908cd

File tree

7 files changed

+2921
-47
lines changed

7 files changed

+2921
-47
lines changed

.pre-commit-config.yaml.orig

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
ci:
3+
autoupdate_schedule: monthly
4+
5+
repos:
6+
- repo: https://github.com/astral-sh/ruff-pre-commit
7+
<<<<<<< HEAD
8+
rev: v0.9.3
9+
||||||| parent of 4b73e13 (Use dependency groups & a fully locked dev environment)
10+
rev: v0.8.6
11+
=======
12+
rev: v0.9.2
13+
>>>>>>> 4b73e13 (Use dependency groups & a fully locked dev environment)
14+
hooks:
15+
- id: ruff
16+
args: [--fix, --exit-non-zero-on-fix]
17+
- id: ruff-format
18+
19+
- repo: https://github.com/econchick/interrogate
20+
rev: 1.7.0
21+
hooks:
22+
- id: interrogate
23+
args: [tests]
24+
25+
- repo: https://github.com/codespell-project/codespell
26+
rev: v2.4.0
27+
hooks:
28+
- id: codespell
29+
args: [--exclude-file=tests/test_mypy.yml]
30+
31+
- repo: https://github.com/pre-commit/pre-commit-hooks
32+
rev: v5.0.0
33+
hooks:
34+
- id: trailing-whitespace
35+
- id: end-of-file-fixer
36+
- id: check-toml
37+
- id: check-yaml

pyproject.toml

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,11 @@ name = "attrs"
1010
authors = [{ name = "Hynek Schlawack", email = "[email protected]" }]
1111
license = "MIT"
1212
license-files = ["LICENSE"]
13-
requires-python = ">=3.8"
13+
requires-python = ">=3.9"
1414
description = "Classes Without Boilerplate"
1515
keywords = ["class", "attribute", "boilerplate"]
1616
classifiers = [
1717
"Development Status :: 5 - Production/Stable",
18-
"Programming Language :: Python :: 3.8",
1918
"Programming Language :: Python :: 3.9",
2019
"Programming Language :: Python :: 3.10",
2120
"Programming Language :: Python :: 3.11",
@@ -28,29 +27,41 @@ classifiers = [
2827
dependencies = []
2928
dynamic = ["version", "readme"]
3029

31-
[project.optional-dependencies]
30+
[project.urls]
31+
Documentation = "https://www.attrs.org/"
32+
Changelog = "https://www.attrs.org/en/stable/changelog.html"
33+
GitHub = "https://github.com/python-attrs/attrs"
34+
Funding = "https://github.com/sponsors/hynek"
35+
Tidelift = "https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=pypi"
36+
37+
38+
[dependency-groups]
3239
tests-mypy = [
3340
'pytest-mypy-plugins; platform_python_implementation == "CPython" and python_version >= "3.10"',
3441
# Since the mypy error messages keep changing, we have to keep updating this
3542
# pin.
3643
'mypy>=1.11.1; platform_python_implementation == "CPython" and python_version >= "3.10"',
3744
]
3845
tests = [
46+
{ include-group = "tests-mypy" },
3947
# For regression test to ensure cloudpickle compat doesn't break.
4048
'cloudpickle; platform_python_implementation == "CPython"',
4149
"hypothesis",
4250
"pympler",
4351
# 4.3.0 dropped last use of `convert`
4452
"pytest>=4.3.0",
45-
"pytest-xdist[psutil]",
46-
"attrs[tests-mypy]",
4753
]
4854
cov = [
49-
"attrs[tests]",
55+
{ include-group = "tests" },
5056
# Ensure coverage is new enough for `source_pkgs`.
5157
"coverage[toml]>=5.3",
5258
]
53-
benchmark = ["pytest-codspeed", "pytest-xdist[psutil]", "attrs[tests]"]
59+
pyright = ["pyright", { include-group = "tests" }]
60+
benchmark = [
61+
{ include-group = "tests" },
62+
"pytest-codspeed",
63+
"pytest-xdist[psutil]",
64+
]
5465
docs = [
5566
"cogapp",
5667
"furo",
@@ -59,17 +70,10 @@ docs = [
5970
"sphinx-notfound-page",
6071
"sphinxcontrib-towncrier",
6172
# See https://github.com/sphinx-contrib/sphinxcontrib-towncrier/issues/92
62-
# Pin also present in tox.ini
6373
"towncrier<24.7",
6474
]
65-
dev = ["attrs[tests]", "pre-commit-uv"]
66-
67-
[project.urls]
68-
Documentation = "https://www.attrs.org/"
69-
Changelog = "https://www.attrs.org/en/stable/changelog.html"
70-
GitHub = "https://github.com/python-attrs/attrs"
71-
Funding = "https://github.com/sponsors/hynek"
72-
Tidelift = "https://tidelift.com/subscription/pkg/pypi-attrs?utm_source=pypi-attrs&utm_medium=pypi"
75+
docs-watch = [{ include-group = "docs" }, "watchfiles"]
76+
dev = [{ include-group = "tests" }]
7377

7478

7579
[tool.hatch.version]
@@ -227,6 +231,8 @@ ignore = [
227231
"TD", # we don't follow other people's todo style
228232
"TRY301", # I'm sorry, but this makes not sense for us.
229233
"UP031", # format() is slow as molasses; % and f'' FTW.
234+
"UP006", # replace Dict etc by dict etc later.
235+
"UP035", # replace Dict etc by dict etc later.
230236
]
231237

232238
[tool.ruff.lint.per-file-ignores]
@@ -254,10 +260,10 @@ ignore = [
254260
"src/*/*.pyi" = ["ALL"] # TODO
255261
"tests/test_annotations.py" = ["FA100"]
256262
"tests/typing_example.py" = [
257-
"E741", # ambiguous variable names don't matter in type checks
258-
"B018", # useless expressions aren't useless in type checks
259-
"B015", # pointless comparison in type checks aren't pointless
260-
"UP037", # we test some older syntaxes on purpose
263+
"E741", # ambiguous variable names don't matter in type checks
264+
"B018", # useless expressions aren't useless in type checks
265+
"B015", # pointless comparison in type checks aren't pointless
266+
"UP037", # we test some older syntaxes on purpose
261267
]
262268

263269
[tool.ruff.lint.isort]

src/attr/_compat.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010

1111

1212
PYPY = platform.python_implementation() == "PyPy"
13-
PY_3_9_PLUS = sys.version_info[:2] >= (3, 9)
1413
PY_3_10_PLUS = sys.version_info[:2] >= (3, 10)
1514
PY_3_11_PLUS = sys.version_info[:2] >= (3, 11)
1615
PY_3_12_PLUS = sys.version_info[:2] >= (3, 12)

src/attr/_funcs.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
import copy
55

6-
from ._compat import PY_3_9_PLUS, get_generic_base
6+
from ._compat import get_generic_base
77
from ._make import _OBJ_SETATTR, NOTHING, fields
88
from .exceptions import AttrsAttributeNotFoundError
99

@@ -450,10 +450,11 @@ class yet.
450450
if getattr(cls, "__attrs_types_resolved__", None) != cls:
451451
import typing
452452

453-
kwargs = {"globalns": globalns, "localns": localns}
454-
455-
if PY_3_9_PLUS:
456-
kwargs["include_extras"] = include_extras
453+
kwargs = {
454+
"globalns": globalns,
455+
"localns": localns,
456+
"include_extras": include_extras,
457+
}
457458

458459
hints = typing.get_type_hints(cls, **kwargs)
459460
for field in fields(cls) if attribs is None else attribs:

0 commit comments

Comments
 (0)