Skip to content

Commit d38a5a5

Browse files
committed
Finalize 3.8 drop
1 parent fffc548 commit d38a5a5

9 files changed

+20
-17
lines changed

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ ci:
44

55
repos:
66
- repo: https://github.com/astral-sh/ruff-pre-commit
7-
rev: v0.8.6
7+
rev: v0.9.2
88
hooks:
99
- id: ruff
1010
args: [--fix, --exit-non-zero-on-fix]

pyproject.toml

+4-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ 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 = [
@@ -226,6 +226,8 @@ ignore = [
226226
"TD", # we don't follow other people's todo style
227227
"TRY301", # I'm sorry, but this makes not sense for us.
228228
"UP031", # format() is slow as molasses; % and f'' FTW.
229+
"UP006", # replace Dict etc by dict etc later.
230+
"UP035", # replace Dict etc by dict etc later.
229231
]
230232

231233
[tool.ruff.lint.per-file-ignores]
@@ -242,6 +244,7 @@ ignore = [
242244
"PLR0124", # pointless comparison in tests aren't pointless
243245
"PT011", # broad is fine
244246
"PT012", # sometimes we need more than a single stmt
247+
"RUF009", # using results of function calls as defaults is fine
245248
"RUF012", # we don't do ClassVar annotations in tests
246249
"S", # security concerns don't matter in tests
247250
"SIM201", # sometimes we need to check `not ==`

src/attr/_compat.py

-1
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

+6-5
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:

src/attr/_make.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -2285,7 +2285,7 @@ def _attrs_to_init_script(
22852285
NL = "\n "
22862286
return (
22872287
f"""def {method_name}(self, {args}):
2288-
{NL.join(lines) if lines else 'pass'}
2288+
{NL.join(lines) if lines else "pass"}
22892289
""",
22902290
names_for_globals,
22912291
annotations,

tests/test_annotations.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import pytest
1212

1313
import attr
14+
import attrs
1415

1516
from attr._compat import PY_3_14_PLUS
1617
from attr._make import _is_class_var
@@ -107,7 +108,7 @@ def test_auto_attribs(self, slots):
107108
class C:
108109
cls_var: typing.ClassVar[int] = 23
109110
a: int
110-
x: typing.List[int] = attr.Factory(list)
111+
x: typing.List[int] = attrs.Factory(list)
111112
y: int = 2
112113
z: int = attr.ib(default=3)
113114
foo: typing.Any = None
@@ -407,7 +408,7 @@ class C:
407408
cls_var2: "ClassVar[int]" = 23
408409
cls_var3: "t.ClassVar[int]" = 23
409410
a: "int"
410-
x: "typing.List[int]" = attr.Factory(list)
411+
x: "typing.List[int]" = attrs.Factory(list)
411412
y: "int" = 2
412413
z: "int" = attr.ib(default=3)
413414
foo: "typing.Any" = None

tests/test_validators.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1074,8 +1074,7 @@ def test_repr(self):
10741074
v = not_(wrapped)
10751075

10761076
assert (
1077-
f"<not_ validator wrapping {wrapped!r}, "
1078-
f"capturing {v.exc_types!r}>"
1077+
f"<not_ validator wrapping {wrapped!r}, capturing {v.exc_types!r}>"
10791078
) == repr(v)
10801079

10811080
def test_success_because_fails(self):

tests/typing_example.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ class Validated2:
269269

270270
@attrs.define
271271
class Validated3:
272-
num: int = attr.field(validator=attr.validators.ge(0))
272+
num: int = attrs.field(validator=attr.validators.ge(0))
273273

274274

275275
with attr.validators.disabled():

tox.ini

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
min_version = 4
33
env_list =
44
pre-commit,
5-
py3{8,9,10,11,12,13}-tests,
5+
py3{9,10,11,12,13}-tests,
66
py3{10,11,12,13}-mypy,
77
pypy3-tests,
88
pyright,
@@ -31,7 +31,7 @@ commands =
3131
dependency_groups = tests
3232
commands = pytest tests/test_functional.py
3333

34-
[testenv:py3{8,10,13}-tests]
34+
[testenv:py3{9,10,13}-tests]
3535
dependency_groups = cov
3636
# Python 3.6+ has a number of compile-time warnings on invalid string escapes.
3737
# PYTHONWARNINGS=d makes them visible during the tox run.
@@ -46,7 +46,7 @@ commands =
4646
# Keep base_python in-sync with .python-version-default
4747
base_python = py313
4848
# Keep depends in-sync with testenv above that has the cov dependency group.
49-
depends = py3{8,10,13}-tests
49+
depends = py3{9,10,13}-tests
5050
skip_install = true
5151
dependency_groups = cov
5252
commands =

0 commit comments

Comments
 (0)