Skip to content

Commit 616b8f3

Browse files
committed
chore: Template upgrade
1 parent aa77865 commit 616b8f3

File tree

13 files changed

+37
-63
lines changed

13 files changed

+37
-63
lines changed

.copier-answers.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier.
2-
_commit: 1.11.2
2+
_commit: 1.11.3
33
_src_path: gh:pawamoy/copier-uv
44
author_email: dev@pawamoy.fr
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ jobs:
4343
python-version: "3.12"
4444
- os: ubuntu-latest
4545
python-version: "3.13"
46+
- os: ubuntu-latest
47+
python-version: "3.15"
4648

4749
runs-on: ${{ matrix.os }}
4850

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,5 @@ uv.lock
2020
# cache
2121
.cache/
2222
.pytest_cache/
23-
.mypy_cache/
2423
.ruff_cache/
2524
__pycache__/

config/mypy.ini

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

config/ruff.toml

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -5,37 +5,17 @@ line-length = 120
55
exclude = [
66
"tests/fixtures/*.py",
77
]
8-
select = [
9-
"A", "ANN", "ARG",
10-
"B", "BLE",
11-
"C", "C4",
12-
"COM",
13-
"D", "DTZ",
14-
"E", "ERA", "EXE",
15-
"F", "FBT",
16-
"G",
17-
"I", "ICN", "INP", "ISC",
18-
"N",
19-
"PGH", "PIE", "PL", "PLC", "PLE", "PLR", "PLW", "PT", "PYI",
20-
"Q",
21-
"RUF", "RSE", "RET",
22-
"S", "SIM", "SLF",
23-
"T", "T10", "T20", "TCH", "TID", "TRY",
24-
"UP",
25-
"W",
26-
"YTT",
27-
]
8+
select = ["ALL"]
289
ignore = [
2910
"A001", # Variable is shadowing a Python builtin
30-
"ANN101", # Missing type annotation for self
31-
"ANN102", # Missing type annotation for cls
3211
"ANN204", # Missing return type annotation for special method __str__
3312
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
3413
"ARG005", # Unused lambda argument
3514
"C901", # Too complex
3615
"D105", # Missing docstring in magic method
3716
"D417", # Missing argument description in the docstring
3817
"E501", # Line too long
18+
"EM101", # String literal when raising exception
3919
"ERA001", # Commented out code
4020
"G004", # Logging statement uses f-string
4121
"PLR0911", # Too many return statements

config/vscode/settings.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,6 @@
44
"**/.venvs*/**": true,
55
"**/venv*/**": true
66
},
7-
"mypy-type-checker.args": [
8-
"--config-file=config/mypy.ini"
9-
],
107
"python.testing.unittestEnabled": false,
118
"python.testing.pytestEnabled": true,
129
"python.testing.pytestArgs": [

duties.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
PTY = not WINDOWS and not CI
2323
MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
2424
PY_VERSION = f"{sys.version_info.major}{sys.version_info.minor}"
25-
PY_DEV = "314"
25+
PY_DEV = "315"
2626

2727

2828
def pyprefix(title: str) -> str:
@@ -35,7 +35,7 @@ def pyprefix(title: str) -> str:
3535
def _get_changelog_version() -> str:
3636
changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$")
3737
with Path(__file__).parent.joinpath("CHANGELOG.md").open("r", encoding="utf8") as file:
38-
return next(filter(bool, map(changelog_version_re.match, file))).group(1) # type: ignore[union-attr]
38+
return next(filter(bool, map(changelog_version_re.match, file))).group(1) # ty: ignore[invalid-argument-type]
3939

4040

4141
@duty
@@ -77,9 +77,9 @@ def check_docs(ctx: Context) -> None:
7777
@duty(nofail=PY_VERSION == PY_DEV)
7878
def check_types(ctx: Context) -> None:
7979
"""Check that the code is correctly typed."""
80-
os.environ["FORCE_COLOR"] = "1"
80+
py = f"{sys.version_info.major}.{sys.version_info.minor}"
8181
ctx.run(
82-
tools.mypy(*PY_SRC_LIST, config_file="config/mypy.ini"),
82+
tools.ty.check(*PY_SRC_LIST, color=True, error_on_warning=True, python_version=py),
8383
title=pyprefix("Type-checking"),
8484
)
8585

pyproject.toml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ getter = "scripts.get_version:get_version"
5151

5252
[tool.pdm.build]
5353
# Include as much as possible in the source distribution, to help redistributors.
54-
excludes = ["**/.pytest_cache", "**/.mypy_cache"]
54+
excludes = ["**/.pytest_cache"]
5555
source-includes = [
5656
"config",
5757
"docs",
@@ -82,13 +82,13 @@ maintain = [
8282
ci = [
8383
"duty>=1.6",
8484
"griffe>=1.10",
85-
"ruff>=0.4",
85+
"pydantic>=2.10",
8686
"pytest>=8.2",
8787
"pytest-cov>=5.0",
8888
"pytest-randomly>=3.15",
8989
"pytest-xdist>=3.6",
90-
"mypy>=1.10",
91-
"pydantic>=2.10",
90+
"ruff>=0.4",
91+
"ty>=0.0.14",
9292
"types-markdown>=3.6",
9393
"types-pyyaml>=6.0",
9494
]

scripts/gen_credits.py

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ def _norm_name(name: str) -> str:
4747
return name.replace("_", "-").replace(".", "-").lower()
4848

4949

50-
def _requirements(deps: list[str]) -> dict[str, Requirement]:
50+
def _requirements(deps: Iterable[str]) -> dict[str, Requirement]:
5151
return {_norm_name((req := Requirement(dep)).name): req for dep in deps}
5252

5353

@@ -63,8 +63,8 @@ def _extra_marker(req: Requirement) -> str | None:
6363
def _get_metadata() -> Metadata:
6464
metadata = {}
6565
for pkg in distributions():
66-
name = _norm_name(pkg.name) # type: ignore[attr-defined,unused-ignore]
67-
metadata[name] = _merge_fields(pkg.metadata) # type: ignore[arg-type]
66+
name = _norm_name(pkg.name)
67+
metadata[name] = _merge_fields(pkg.metadata) # ty: ignore[invalid-argument-type]
6868
metadata[name]["spec"] = set()
6969
metadata[name]["extras"] = set()
7070
metadata[name].setdefault("summary", "")
@@ -77,10 +77,11 @@ def _set_license(metadata: PackageMetadata) -> None:
7777
license_name = license_field if isinstance(license_field, str) else " + ".join(license_field)
7878
check_classifiers = license_name in ("UNKNOWN", "Dual License", "") or license_name.count("\n")
7979
if check_classifiers:
80-
license_names = []
81-
for classifier in metadata["classifier"]:
82-
if classifier.startswith("License ::"):
83-
license_names.append(classifier.rsplit("::", 1)[1].strip())
80+
license_names = [
81+
classifier.rsplit("::", 1)[1].strip()
82+
for classifier in metadata["classifier"]
83+
if classifier.startswith("License ::")
84+
]
8485
license_name = " + ".join(license_names)
8586
metadata["license"] = license_name or "?"
8687

@@ -90,8 +91,8 @@ def _get_deps(base_deps: dict[str, Requirement], metadata: Metadata) -> Metadata
9091
for dep_name, dep_req in base_deps.items():
9192
if dep_name not in metadata or dep_name == "griffe-pydantic":
9293
continue
93-
metadata[dep_name]["spec"] |= {str(spec) for spec in dep_req.specifier} # type: ignore[operator]
94-
metadata[dep_name]["extras"] |= dep_req.extras # type: ignore[operator]
94+
metadata[dep_name]["spec"] |= {str(spec) for spec in dep_req.specifier} # ty: ignore[unsupported-operator]
95+
metadata[dep_name]["extras"] |= dep_req.extras # ty: ignore[unsupported-operator]
9596
deps[dep_name] = metadata[dep_name]
9697

9798
again = True
@@ -109,7 +110,7 @@ def _get_deps(base_deps: dict[str, Requirement], metadata: Metadata) -> Metadata
109110
and dep_name != project["name"]
110111
and (not extra_marker or extra_marker in deps[pkg_name]["extras"])
111112
):
112-
metadata[dep_name]["spec"] |= {str(spec) for spec in requirement.specifier} # type: ignore[operator]
113+
metadata[dep_name]["spec"] |= {str(spec) for spec in requirement.specifier} # ty: ignore[unsupported-operator]
113114
deps[dep_name] = metadata[dep_name]
114115
again = True
115116

@@ -121,7 +122,7 @@ def _render_credits() -> str:
121122
dev_dependencies = _get_deps(_requirements(devdeps), metadata)
122123
prod_dependencies = _get_deps(
123124
_requirements(
124-
chain( # type: ignore[arg-type]
125+
chain(
125126
project.get("dependencies", []),
126127
chain(*project.get("optional-dependencies", {}).values()),
127128
),

scripts/get_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def get_version() -> str:
2222
if scm_version.version <= Version("0.1"): # Missing Git tags?
2323
with suppress(OSError, StopIteration): # noqa: SIM117
2424
with _changelog.open("r", encoding="utf8") as file:
25-
match = next(filter(None, map(_changelog_version_re.match, file)))
25+
match = next(filter(None, map(_changelog_version_re.match, file))) # ty: ignore[invalid-argument-type]
2626
scm_version = scm_version._replace(version=Version(match.group(1)))
2727
return default_version_formatter(scm_version)
2828

0 commit comments

Comments
 (0)