Skip to content

Commit ad6f4ef

Browse files
committed
chore: Template upgrade
1 parent 12bf2d6 commit ad6f4ef

File tree

12 files changed

+244
-206
lines changed

12 files changed

+244
-206
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.2.0
2+
_commit: 1.2.4
33
_src_path: gh:mkdocstrings/handler-template
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ jobs:
2525
steps:
2626
- name: Checkout
2727
uses: actions/checkout@v4
28-
29-
- name: Fetch all tags
30-
run: git fetch --depth=1 --tags
28+
with:
29+
fetch-depth: 0
30+
fetch-tags: true
3131

3232
- name: Setup Python
3333
uses: actions/setup-python@v5
@@ -105,6 +105,9 @@ jobs:
105105
steps:
106106
- name: Checkout
107107
uses: actions/checkout@v4
108+
with:
109+
fetch-depth: 0
110+
fetch-tags: true
108111

109112
- name: Setup Python
110113
uses: actions/setup-python@v5

.github/workflows/release.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ jobs:
1111
steps:
1212
- name: Checkout
1313
uses: actions/checkout@v4
14-
- name: Fetch all tags
15-
run: git fetch --depth=1 --tags
14+
with:
15+
fetch-depth: 0
16+
fetch-tags: true
1617
- name: Setup Python
1718
uses: actions/setup-python@v5
1819
with:

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![ci](https://github.com/mkdocstrings/shell/workflows/ci/badge.svg)](https://github.com/mkdocstrings/shell/actions?query=workflow%3Aci)
44
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/shell/)
55
[![pypi version](https://img.shields.io/pypi/v/mkdocstrings-shell.svg)](https://pypi.org/project/mkdocstrings-shell/)
6-
[![gitpod](https://img.shields.io/badge/gitpod-workspace-708FCC.svg?style=flat)](https://gitpod.io/#https://github.com/mkdocstrings/shell)
76
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#shell:gitter.im)
87

98
A shell scripts/libraries handler for mkdocstrings.

docs/insiders/index.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ else:
8888
```
8989
<!-- blacken-docs:on -->
9090

91+
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/).
92+
9193
## How to become a sponsor
9294

9395
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/shell/discussions"
4343
Gitter = "https://gitter.im/mkdocstrings/shell"
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/insiders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
def human_readable_amount(amount: int) -> str: # noqa: D103
2727
str_amount = str(amount)
2828
if len(str_amount) >= 4: # noqa: PLR2004
29-
return f"{str_amount[:len(str_amount)-3]},{str_amount[-3:]}"
29+
return f"{str_amount[: len(str_amount) - 3]},{str_amount[-3:]}"
3030
return str_amount
3131

3232

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)