Skip to content

Commit 438b961

Browse files
committed
chore: Template upgrade
1 parent bcbc314 commit 438b961

8 files changed

Lines changed: 234 additions & 199 deletions

File tree

.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.2.1
2+
_commit: 1.2.4
33
_src_path: gh:mkdocstrings/handler-template
44
author_email: dev@pawamoy.fr
55
author_fullname: Timothée Mazzucotelli

docs/insiders/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,8 @@ else:
9191
```
9292
<!-- blacken-docs:on -->
9393

94+
Additionally, your sponsorship will give more weight to your upvotes on issues, helping us prioritize work items in our backlog. For more information on how we prioritize work, see this page: [Backlog management](https://pawamoy.github.io/backlog/).
95+
9496
## How to become a sponsor
9597

9698
Thanks for your interest in sponsoring! In order to become an eligible sponsor

duties.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def check_docs(ctx: Context) -> None:
8585
def check_types(ctx: Context) -> None:
8686
"""Check that the code is correctly typed."""
8787
os.environ["MYPYPATH"] = "src"
88+
os.environ["FORCE_COLOR"] = "1"
8889
ctx.run(
8990
tools.mypy(*PY_SRC_LIST, config_file="config/mypy.ini"),
9091
title=pyprefix("Type-checking"),

pyproject.toml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,16 @@ Discussions = "https://github.com/mkdocstrings/typescript/discussions"
4343
Gitter = "https://gitter.im/mkdocstrings/typescript"
4444
Funding = "https://github.com/sponsors/pawamoy"
4545

46-
[tool.pdm]
47-
version = {source = "scm"}
46+
[tool.pdm.version]
47+
source = "call"
48+
getter = "scripts.get_version:get_version"
4849

4950
[tool.pdm.build]
5051
package-dir = "src"
5152
includes = ["src/mkdocstrings_handlers"]
5253
editable-backend = "editables"
54+
55+
# Include as much as possible in the source distribution, to help redistributors.
5356
excludes = ["**/.pytest_cache"]
5457
source-includes = [
5558
"config",
@@ -64,15 +67,15 @@ source-includes = [
6467
]
6568

6669
[tool.pdm.build.wheel-data]
70+
# Manual pages can be included in the wheel.
71+
# Depending on the installation tool, they will be accessible to users.
72+
# pipx supports it, uv does not yet, see https://github.com/astral-sh/uv/issues/4731.
6773
data = [
6874
{path = "share/**/*", relative-to = "."},
6975
]
7076

71-
[tool.uv]
72-
dev-dependencies = [
73-
# dev
74-
"editables>=0.5",
75-
77+
[dependency-groups]
78+
dev = [
7679
# maintenance
7780
"build>=1.2",
7881
"git-changelog>=2.5",

scripts/gen_credits.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
pyproject = tomllib.load(pyproject_file)
2828
project = pyproject["project"]
2929
project_name = project["name"]
30-
devdeps = [dep for dep in pyproject["tool"]["uv"]["dev-dependencies"] if not dep.startswith("-e")]
30+
devdeps = [dep for dep in pyproject["dependency-groups"]["dev"] if not dep.startswith("-e")]
3131

3232
PackageMetadata = dict[str, Union[str, Iterable[str]]]
3333
Metadata = dict[str, PackageMetadata]

scripts/get_version.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
"""Get current project version from Git tags or changelog."""
2+
3+
import re
4+
from contextlib import suppress
5+
from pathlib import Path
6+
7+
from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm
8+
9+
_root = Path(__file__).parent.parent
10+
_changelog = _root / "CHANGELOG.md"
11+
_changelog_version_re = re.compile(r"^## \[(\d+\.\d+\.\d+)\].*$")
12+
_default_scm_version = SCMVersion(Version("0.0.0"), None, False, None, None) # noqa: FBT003
13+
14+
15+
def get_version() -> str:
16+
"""Get current project version from Git tags or changelog."""
17+
scm_version = get_version_from_scm(_root) or _default_scm_version
18+
if scm_version.version <= Version("0.1"): # Missing Git tags?
19+
with suppress(OSError, StopIteration): # noqa: SIM117
20+
with _changelog.open("r", encoding="utf8") as file:
21+
match = next(filter(None, map(_changelog_version_re.match, file)))
22+
scm_version = scm_version._replace(version=Version(match.group(1)))
23+
return default_version_formatter(scm_version)
24+
25+
26+
if __name__ == "__main__":
27+
print(get_version())

scripts/make

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

scripts/make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
make.py

0 commit comments

Comments
 (0)