Skip to content

Commit 34ff1fd

Browse files
committed
Switch to ruff for formatting
1 parent a829300 commit 34ff1fd

File tree

12 files changed

+34
-101
lines changed

12 files changed

+34
-101
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ jobs:
108108
- uses: hynek/setup-cached-uv@757bedc3f972eb7227a1aa657651f15a8527c817
109109

110110
- name: "Build package"
111-
run: "uvx pdm build"
111+
run: "uv build"
112112
- name: "List result"
113113
run: "ls -l dist"
114114
- name: "Check wheel contents"

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,4 +67,3 @@ settings.json
6767
.editorconfig
6868
.mypy_cache
6969
.pytest_cache
70-
.pdm-python

HISTORY.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Our backwards-compatibility policy can be found [here](https://github.com/python
2020
([#728](https://github.com/python-attrs/cattrs/pull/728))
2121
- Fix the `detailed_validation` parameter being passed under the wrong name in {func}`namedtuple_dict_structure_factory <cattrs.cols.namedtuple_dict_structure_factory>`, causing it to be silently ignored.
2222
([#723](https://github.com/python-attrs/cattrs/pull/723))
23+
- _cattrs_ is now autoformatted using Ruff.
2324

2425
## 26.1.0 (2026-02-18)
2526

Justfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ sync version="":
77

88
lint:
99
uv run -p python3.14 --group lint ruff check src/ tests bench
10-
uv run -p python3.14 --group lint black --check src tests docs/conf.py
10+
uv run -p python3.14 --group lint ruff format --check src tests docs/conf.py
1111

1212
test *args="-x --ff -n auto tests":
1313
uv run {{ if python != '' { '-p ' + python } else { '' } }} --all-extras --group test --group lint pytest {{args}}

pyproject.toml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
1-
[tool.black]
2-
skip-magic-trailing-comma = true
3-
41
[dependency-groups]
52
lint = [
6-
"black>=25.1.0",
73
"ruff>=0.12.2",
84
]
95
test = [
@@ -169,6 +165,12 @@ ignore = [
169165
# Preserve types, even if a file imports `from __future__ import annotations`.
170166
keep-runtime-typing = true
171167

168+
[tool.ruff.lint.isort]
169+
split-on-trailing-comma = false
170+
171+
[tool.ruff.format]
172+
skip-magic-trailing-comma = true
173+
172174
[tool.hatch.version]
173175
source = "vcs"
174176
raw-options = { local_scheme = "no-local-version" }

src/cattrs/cols.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,6 @@ def structure_tuple(obj: Iterable[T], _: type = type) -> tuple[T, ...]:
178178
handler = converter.structure
179179

180180
if converter.detailed_validation:
181-
182181
# We have to structure into a list first anyway.
183182
list_structure = list_structure_factory(type, converter)
184183

tests/preconf/test_pyyaml.py

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

1717
@given(everythings())
1818
def test_pyyaml(everything: Everything):
19-
2019
converter = make_converter()
2120
unstructured = converter.unstructure(everything)
2221
raw = safe_dump(unstructured)

tests/test_generics.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ class Outer(Generic[T]):
320320

321321
@pytest.mark.skipif(not is_py311_plus, reason="3.11+ only")
322322
def test_generate_typeddict_mapping() -> None:
323-
324323
T = TypeVar("T")
325324
U = TypeVar("U")
326325

tests/test_preconf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,6 @@ class A:
798798
booleans(),
799799
)
800800
def test_tomllib_converter(everything: Everything, detailed_validation: bool):
801-
802801
converter = tomllib_make_converter(detailed_validation=detailed_validation)
803802
raw = converter.dumps(everything)
804803

tests/test_structure_attrs.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_structure_union(cl_and_vals_a, cl_and_vals_b):
8686
"""Structuring of automatically-disambiguable unions works."""
8787
converter = BaseConverter()
8888
cl_a, vals_a, kwargs_a = cl_and_vals_a
89-
cl_b, vals_b, kwargs_b = cl_and_vals_b
89+
cl_b, _, _ = cl_and_vals_b
9090
a_field_names = {a.name for a in fields(cl_a)}
9191
b_field_names = {a.name for a in fields(cl_b)}
9292
assume(a_field_names)
@@ -126,7 +126,7 @@ def test_structure_union_explicit(cl_and_vals_a, cl_and_vals_b):
126126
"""Structuring of manually-disambiguable unions works."""
127127
converter = BaseConverter()
128128
cl_a, vals_a, kwargs_a = cl_and_vals_a
129-
cl_b, vals_b, kwargs_b = cl_and_vals_b
129+
cl_b, _, _ = cl_and_vals_b
130130

131131
def dis(obj, _):
132132
return converter.structure(obj, cl_a)

0 commit comments

Comments
 (0)