Skip to content

Commit f2bda60

Browse files
flying-sheeppre-commit-ci[bot]grst
authored
TOML formatting using pyproject-fmt (#299)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Gregor Sturm <[email protected]>
1 parent f0a10d4 commit f2bda60

File tree

6 files changed

+190
-200
lines changed

6 files changed

+190
-200
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[*.{yml,yaml}]
11+
[*.{yml,yaml,toml}]
1212
indent_size = 2
1313

1414
[Makefile]

.pre-commit-config.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ repos:
55
hooks:
66
- id: prettier
77
# Hooks that are run for scripts
8+
- repo: https://github.com/tox-dev/pyproject-fmt
9+
rev: "2.2.1"
10+
hooks:
11+
- id: pyproject-fmt
12+
files: ^scripts/
813
- repo: https://github.com/astral-sh/ruff-pre-commit
914
rev: v0.6.2
1015
hooks:

scripts/pyproject.toml

Lines changed: 86 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,45 @@
11
[build-system]
2-
requires = ["hatchling", "hatch-vcs"]
32
build-backend = "hatchling.build"
3+
requires = [ "hatch-vcs", "hatchling" ]
44

55
[project]
66
name = "scverse-template-scripts"
7-
dynamic = ["version"]
87
description = "scripts for ecosystem package data"
98
readme = "../README.md"
10-
requires-python = ">=3.11"
119
license = "GPL-3.0"
1210
authors = [
13-
{ name = "Philipp A.", email = "[email protected]" },
11+
{ name = "Philipp A.", email = "[email protected]" },
1412
]
15-
urls.Documentation = "https://github.com/scverse/cookiecutter-scverse#readme"
16-
urls.Issues = "https://github.com/scverse/cookiecutter-scverse/issues"
17-
urls.Source = "https://github.com/scverse/cookiecutter-scverse"
13+
requires-python = ">=3.11"
14+
classifiers = [
15+
"Programming Language :: Python :: 3 :: Only",
16+
"Programming Language :: Python :: 3.11",
17+
"Programming Language :: Python :: 3.12",
18+
]
19+
dynamic = [ "version" ]
1820
dependencies = [
19-
"cruft",
20-
"rich",
21-
"typer",
22-
"furl",
23-
"GitPython",
24-
"PyGitHub >= 2",
25-
"PyYAML",
26-
"pre-commit", # is ran by cruft
21+
"cruft",
22+
"furl",
23+
"gitpython",
24+
"pre-commit", # is ran by cruft
25+
"pygithub>=2",
26+
"pyyaml",
27+
"rich",
28+
"typer",
2729
]
28-
29-
[project.optional-dependencies]
30-
test = [
31-
"pytest",
32-
"pytest-socket",
33-
"pytest-responsemock",
30+
optional-dependencies.test = [
31+
"pytest",
32+
"pytest-responsemock",
33+
"pytest-socket",
3434
]
35-
36-
[project.scripts]
37-
send-cruft-prs = "scverse_template_scripts.cruft_prs:cli"
38-
make-rich-output = "scverse_template_scripts.make_rich_output:main"
35+
urls.Documentation = "https://github.com/scverse/cookiecutter-scverse#readme"
36+
urls.Issues = "https://github.com/scverse/cookiecutter-scverse/issues"
37+
urls.Source = "https://github.com/scverse/cookiecutter-scverse"
38+
scripts.make-rich-output = "scverse_template_scripts.make_rich_output:main"
39+
scripts.send-cruft-prs = "scverse_template_scripts.cruft_prs:cli"
3940

4041
[tool.hatch.build.targets.wheel]
41-
packages = ["src/testing", "src/scverse_template_scripts"]
42+
packages = [ "src/testing", "src/scverse_template_scripts" ]
4243

4344
[tool.hatch.version]
4445
source = "vcs"
@@ -48,75 +49,72 @@ fallback-version = "0.0"
4849
python = "3.11"
4950

5051
[tool.hatch.envs.hatch-test]
51-
features = ["test"]
52-
53-
[tool.pytest.ini_options]
54-
addopts = [
55-
"--import-mode=importlib",
56-
"--disable-socket",
57-
"-presponsemock",
58-
"-ptesting.scverse_template_scripts._pytest"
59-
]
60-
filterwarnings = [
61-
"error",
62-
# https://github.com/man-group/pytest-plugins/issues/224
63-
"ignore::DeprecationWarning:pytest_shutil",
64-
]
52+
features = [ "test" ]
6553

6654
[tool.ruff]
6755
line-length = 120
6856

69-
[tool.ruff.format]
70-
docstring-code-format = true
57+
format.docstring-code-format = true
7158

72-
[tool.ruff.lint]
73-
allowed-confusables = ["", "×"]
74-
select = [
75-
"A",
76-
"ARG",
77-
"B",
78-
"C",
79-
"DTZ",
80-
"E",
81-
"EM",
82-
"F",
83-
"FBT",
84-
"I",
85-
"ICN",
86-
"ISC",
87-
"N",
88-
"PLC",
89-
"PLE",
90-
"PLR",
91-
"PLW",
92-
"Q",
93-
"RUF",
94-
"S",
95-
"T",
96-
"TCH",
97-
"TID",
98-
"UP",
99-
"W",
100-
"YTT",
59+
lint.select = [
60+
"A",
61+
"ARG",
62+
"B",
63+
"C",
64+
"DTZ",
65+
"E",
66+
"EM",
67+
"F",
68+
"FBT",
69+
"I",
70+
"ICN",
71+
"ISC",
72+
"N",
73+
"PLC",
74+
"PLE",
75+
"PLR",
76+
"PLW",
77+
"Q",
78+
"RUF",
79+
"S",
80+
"T",
81+
"TCH",
82+
"TID",
83+
"UP",
84+
"W",
85+
"YTT",
10186
]
102-
ignore = [
103-
"S101", # assert should be allowed
104-
"S603", # subprocess with shell=False should be allowed
105-
"S311", # we don’t need cryptographically secure RNG
106-
"ISC001", # conflicts with formatter
87+
lint.ignore = [
88+
"ISC001", # conflicts with formatter
89+
"S101", # assert should be allowed
90+
"S311", # we don’t need cryptographically secure RNG
91+
"S603", # subprocess with shell=False should be allowed
10792
]
108-
unfixable = ["RUF001"] # never “fix” “confusables”
109-
110-
[tool.ruff.lint.isort]
111-
known-first-party = ["scverse_template_scripts", "testing.scverse_template_scripts"]
112-
required-imports = ["from __future__ import annotations"]
93+
lint.per-file-ignores."tests/*.py" = [
94+
"ARG001", # pytest fixtures don’t need to be used
95+
"PLR0913", # allow as many pytest fixtures being used as one likes
96+
]
97+
lint.unfixable = [
98+
"RUF001", # never “fix” “confusables”
99+
]
100+
lint.allowed-confusables = [ "×", "" ]
101+
lint.flake8-type-checking.exempt-modules = [ ]
102+
lint.flake8-type-checking.strict = true
103+
lint.isort.known-first-party = [ "scverse_template_scripts", "testing.scverse_template_scripts" ]
104+
lint.isort.required-imports = [ "from __future__ import annotations" ]
113105

114-
[tool.ruff.lint.flake8-type-checking]
115-
exempt-modules = []
116-
strict = true
106+
[tool.pyproject-fmt]
107+
column_width = 120
117108

118-
[tool.ruff.lint.per-file-ignores]
119-
"tests/*.py" = [
120-
"ARG001", # pytest fixtures don’t need to be used
121-
"PLR0913", # allow as many pytest fixtures being used as one likes
109+
[tool.pytest.ini_options]
110+
addopts = [
111+
"--import-mode=importlib",
112+
"--disable-socket",
113+
"-presponsemock",
114+
"-ptesting.scverse_template_scripts._pytest",
115+
]
116+
filterwarnings = [
117+
"error",
118+
# https://github.com/man-group/pytest-plugins/issues/224
119+
"ignore::DeprecationWarning:pytest_shutil",
122120
]

{{cookiecutter.project_name}}/.editorconfig

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ charset = utf-8
88
trim_trailing_whitespace = true
99
insert_final_newline = true
1010

11-
[*.{yml,yaml}]
12-
indent_size = 2
13-
14-
[.cruft.json]
11+
[{*.{yml,yaml,toml},.cruft.json}]
1512
indent_size = 2
1613

1714
[Makefile]

{{cookiecutter.project_name}}/.pre-commit-config.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@ repos:
1010
rev: v4.0.0-alpha.8
1111
hooks:
1212
- id: prettier
13+
- repo: https://github.com/tox-dev/pyproject-fmt
14+
rev: "2.2.1"
15+
hooks:
16+
- id: pyproject-fmt
1317
- repo: https://github.com/astral-sh/ruff-pre-commit
1418
rev: v0.6.2
1519
hooks:

0 commit comments

Comments
 (0)