Skip to content

Commit c353b44

Browse files
authored
Update formatting (#63)
1 parent 921f33d commit c353b44

File tree

10 files changed

+89
-79
lines changed

10 files changed

+89
-79
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
1-
minimum_pre_commit_version: "2.21.0" # rust version selection
2-
ci:
3-
skip: [taplo]
41
repos:
52
- repo: https://github.com/pre-commit/pre-commit-hooks
63
rev: v5.0.0
@@ -12,18 +9,18 @@ repos:
129
hooks:
1310
- id: ruff
1411
args: [--fix, --exit-non-zero-on-fix]
15-
- repo: https://github.com/pre-commit/mirrors-prettier
16-
rev: v4.0.0-alpha.8
12+
- id: ruff
13+
args: [--preview, --select=CPY]
14+
- id: ruff-format
15+
- repo: https://github.com/biomejs/pre-commit
16+
rev: v0.5.0
1717
hooks:
18-
- id: prettier
19-
additional_dependencies:
20-
- prettier
21-
- prettier-plugin-jinja-template
22-
- repo: https://github.com/ComPWA/mirrors-taplo
23-
rev: v0.8.1
18+
- id: biome-format
19+
additional_dependencies: ["@biomejs/biome@1.9.4"]
20+
- repo: https://github.com/tox-dev/pyproject-fmt
21+
rev: v2.5.0
2422
hooks:
25-
- id: taplo
26-
language_version: stable
23+
- id: pyproject-fmt
2724
- repo: https://github.com/pre-commit/mirrors-mypy
2825
rev: v1.13.0
2926
hooks:

.prettierrc.cjs

Lines changed: 0 additions & 20 deletions
This file was deleted.

.vscode/extensions.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
11
{
2-
"recommendations": ["charliermarsh.ruff", "ms-python.python"],
2+
"recommendations": [
3+
"charliermarsh.ruff",
4+
"ms-python.python",
5+
"biomejs.biome",
6+
],
37
}

.vscode/settings.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
"source.organizeImports": "always",
1111
},
1212
},
13-
"[toml]": {
13+
"[json][jsonc]": {
1414
"editor.formatOnSave": true,
15-
"editor.defaultFormatter": "tamasfe.even-better-toml",
15+
"editor.defaultFormatter": "biomejs.biome",
1616
},
1717
}

biome.jsonc

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
3+
"overrides": [
4+
{
5+
"include": ["./.vscode/*.json", "**/*.jsonc"],
6+
"json": {
7+
"formatter": {
8+
"trailingCommas": "all",
9+
"indentStyle": "space",
10+
"indentWidth": 4,
11+
},
12+
"parser": {
13+
"allowComments": true,
14+
"allowTrailingCommas": true,
15+
},
16+
},
17+
},
18+
],
19+
}

pyproject.toml

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,70 @@
1+
[build-system]
2+
build-backend = "hatchling.build"
3+
requires = [ "hatch-docstring-description", "hatch-vcs", "hatchling" ]
4+
15
[project]
2-
dynamic = ["version", "description"]
36
name = "legacy-api-wrap"
4-
authors = [{ name = "Philipp A.", email = "flying-sheep@web.de" }]
5-
urls.Source = "https://github.com/flying-sheep/legacy-api-wrap"
67
readme = "README.rst"
78
license = "MPL-2.0"
9+
authors = [ { name = "Philipp A.", email = "flying-sheep@web.de" } ]
810
requires-python = ">=3.8"
911
classifiers = [
1012
"Development Status :: 5 - Production/Stable",
1113
"Intended Audience :: Developers",
12-
"Programming Language :: Python :: 3",
14+
"Programming Language :: Python :: 3 :: Only",
15+
"Programming Language :: Python :: 3.8",
16+
"Programming Language :: Python :: 3.9",
17+
"Programming Language :: Python :: 3.10",
18+
"Programming Language :: Python :: 3.11",
19+
"Programming Language :: Python :: 3.12",
20+
"Programming Language :: Python :: 3.13",
1321
"Topic :: Software Development :: Libraries :: Python Modules",
1422
"Typing :: Typed",
1523
]
16-
dependencies = []
17-
[project.optional-dependencies]
18-
test = [
19-
"pytest",
24+
dynamic = [ "description", "version" ]
25+
dependencies = [ ]
26+
optional-dependencies.test = [
27+
"anyconfig[toml]>=0.14", # coverage-rich uses anyconfig
2028
"coverage",
2129
"coverage-rich",
22-
"anyconfig[toml] >=0.14", # coverage-rich uses anyconfig
30+
"pytest",
2331
]
32+
urls.Source = "https://github.com/flying-sheep/legacy-api-wrap"
33+
34+
[tool.hatch.version]
35+
source = "vcs"
36+
[tool.hatch.build.targets.wheel]
37+
packages = [ "src/legacy_api_wrap", "src/testing/legacy_api_wrap" ]
38+
39+
[tool.hatch.envs.test]
40+
features = [ "test" ]
41+
[tool.hatch.envs.test.scripts]
42+
run = "pytest {args}"
43+
cov = "coverage run -m pytest {args} && coverage-rich report && coverage html"
44+
[[tool.hatch.envs.test.matrix]]
45+
python = [ "3.8", "3.9", "3.10", "3.11" ]
2446

2547
[tool.ruff]
2648
line-length = 100
27-
select = ["ALL"]
28-
ignore = [
29-
"D203", # zero instead of one blank lines before class
30-
"D213", # multiline summary on first instead of second line
49+
lint.select = [ "ALL" ]
50+
lint.ignore = [
51+
"COM812", # incompatible with formatter
52+
"D203", # zero instead of one blank lines before class
53+
"D213", # multiline summary on first instead of second line
54+
"ISC001", # incompatible with formatter
3155
]
32-
allowed-confusables = [""]
33-
[tool.ruff.isort]
34-
known-first-party = ["legacy_api_wrap"]
35-
required-imports = ["from __future__ import annotations"]
36-
[tool.ruff.extend-per-file-ignores]
37-
"src/testing/*.py" = ["INP001"]
38-
"tests/**/test_*.py" = [
56+
lint.extend-per-file-ignores."src/testing/*.py" = [ "INP001" ]
57+
lint.extend-per-file-ignores."tests/**/test_*.py" = [
3958
"D100", # tests need no module docstrings
4059
"D103", # tests need no function docstrings
4160
"INP001", # tests should not have __init__.py
4261
"PLR2004", # tests use magic values
4362
"S101", # tests use `assert`
4463
]
45-
46-
[tool.mypy]
47-
strict = true
48-
explicit_package_bases = true
49-
mypy_path = "src"
64+
lint.allowed-confusables = [ "" ]
65+
lint.flake8-copyright.notice-rgx = "SPDX-License-Identifier: MPL-2\\.0"
66+
lint.isort.known-first-party = [ "legacy_api_wrap" ]
67+
lint.isort.required-imports = [ "from __future__ import annotations" ]
5068

5169
[tool.pytest.ini_options]
5270
addopts = [
@@ -62,22 +80,10 @@ addopts = [
6280
run.data_file = "test-data/coverage"
6381
xml.output = "test-data/coverage.xml"
6482
html.directory = "test-data/htmlcov"
65-
run.omit = ["src/testing/*", "tests/*"]
66-
report.exclude_also = ["if TYPE_CHECKING:"]
67-
68-
[tool.hatch.version]
69-
source = "vcs"
70-
[tool.hatch.build.targets.wheel]
71-
packages = ["src/legacy_api_wrap", "src/testing/legacy_api_wrap"]
83+
run.omit = [ "src/testing/*", "tests/*" ]
84+
report.exclude_also = [ "if TYPE_CHECKING:" ]
7285

73-
[tool.hatch.envs.test]
74-
features = ["test"]
75-
[tool.hatch.envs.test.scripts]
76-
run = "pytest {args}"
77-
cov = "coverage run -m pytest {args} && coverage-rich report && coverage html"
78-
[[tool.hatch.envs.test.matrix]]
79-
python = ["3.8", "3.9", "3.10", "3.11"]
80-
81-
[build-system]
82-
requires = ["hatchling", "hatch-vcs", "hatch-docstring-description"]
83-
build-backend = "hatchling.build"
86+
[tool.mypy]
87+
strict = true
88+
explicit_package_bases = true
89+
mypy_path = "src"

src/legacy_api_wrap/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: MPL-2.0
12
"""Legacy API wrapper.
23
34
>>> from legacy_api_wrap import legacy_api
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
# SPDX-License-Identifier: MPL-2.0
12
"""Testing utils for legacy_api_wrap."""

src/testing/legacy_api_wrap/pytest.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: MPL-2.0
12
"""Pytest plugin for legacy_api_wrap."""
23

34
from __future__ import annotations

tests/test_basic.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# SPDX-License-Identifier: MPL-2.0
12
from __future__ import annotations
23

34
from inspect import signature

0 commit comments

Comments
 (0)