Skip to content

Commit cbdf294

Browse files
committed
chore: Template upgrade
1 parent 6dafa9a commit cbdf294

15 files changed

+142
-157
lines changed

.copier-answers.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.1.4
2+
_commit: 1.2.0
33
_src_path: gh:mkdocstrings/handler-template
44
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

+18-11
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,16 @@ jobs:
2929
- name: Fetch all tags
3030
run: git fetch --depth=1 --tags
3131

32-
- name: Set up Python
32+
- name: Setup Python
3333
uses: actions/setup-python@v5
3434
with:
35-
python-version: "3.11"
35+
python-version: "3.12"
3636

37-
- name: Install uv
38-
run: pip install uv
37+
- name: Setup uv
38+
uses: astral-sh/setup-uv@v3
39+
with:
40+
enable-cache: true
41+
cache-dependency-glob: pyproject.toml
3942

4043
- name: Install dependencies
4144
run: make setup
@@ -63,11 +66,11 @@ jobs:
6366
echo 'jobs=[
6467
{"os": "macos-latest"},
6568
{"os": "windows-latest"},
66-
{"python-version": "3.9"},
6769
{"python-version": "3.10"},
6870
{"python-version": "3.11"},
6971
{"python-version": "3.12"},
70-
{"python-version": "3.13"}
72+
{"python-version": "3.13"},
73+
{"python-version": "3.14"}
7174
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
7275
else
7376
echo 'jobs=[
@@ -87,31 +90,35 @@ jobs:
8790
- macos-latest
8891
- windows-latest
8992
python-version:
90-
- "3.8"
9193
- "3.9"
9294
- "3.10"
9395
- "3.11"
9496
- "3.12"
9597
- "3.13"
98+
- "3.14"
9699
resolution:
97100
- highest
98101
- lowest-direct
99102
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
100103
runs-on: ${{ matrix.os }}
101-
continue-on-error: ${{ matrix.python-version == '3.13' }}
104+
continue-on-error: ${{ matrix.python-version == '3.14' }}
102105

103106
steps:
104107
- name: Checkout
105108
uses: actions/checkout@v4
106109

107-
- name: Set up Python
110+
- name: Setup Python
108111
uses: actions/setup-python@v5
109112
with:
110113
python-version: ${{ matrix.python-version }}
111114
allow-prereleases: true
112115

113-
- name: Install uv
114-
run: pip install uv
116+
- name: Setup uv
117+
uses: astral-sh/setup-uv@v3
118+
with:
119+
enable-cache: true
120+
cache-dependency-glob: pyproject.toml
121+
cache-suffix: py${{ matrix.python-version }}
115122

116123
- name: Install dependencies
117124
env:

.github/workflows/release.yml

+9-11
Original file line numberDiff line numberDiff line change
@@ -14,32 +14,30 @@ jobs:
1414
- name: Fetch all tags
1515
run: git fetch --depth=1 --tags
1616
- name: Setup Python
17-
uses: actions/setup-python@v4
18-
- name: Install build
19-
if: github.repository_owner == 'pawamoy-insiders'
20-
run: python -m pip install build
17+
uses: actions/setup-python@v5
18+
with:
19+
python-version: "3.12"
20+
- name: Setup uv
21+
uses: astral-sh/setup-uv@v3
2122
- name: Build dists
2223
if: github.repository_owner == 'pawamoy-insiders'
23-
run: python -m build
24+
run: uv tool run --from build pyproject-build
2425
- name: Upload dists artifact
2526
uses: actions/upload-artifact@v4
2627
if: github.repository_owner == 'pawamoy-insiders'
2728
with:
2829
name: python-insiders
2930
path: ./dist/*
30-
- name: Install git-changelog
31-
if: github.repository_owner != 'pawamoy-insiders'
32-
run: pip install git-changelog
3331
- name: Prepare release notes
3432
if: github.repository_owner != 'pawamoy-insiders'
35-
run: git-changelog --release-notes > release-notes.md
33+
run: uv tool run git-changelog --release-notes > release-notes.md
3634
- name: Create release with assets
37-
uses: softprops/action-gh-release@v1
35+
uses: softprops/action-gh-release@v2
3836
if: github.repository_owner == 'pawamoy-insiders'
3937
with:
4038
files: ./dist/*
4139
- name: Create release
42-
uses: softprops/action-gh-release@v1
40+
uses: softprops/action-gh-release@v2
4341
if: github.repository_owner != 'pawamoy-insiders'
4442
with:
4543
body_path: release-notes.md

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
/.pdm-build/
1616
/htmlcov/
1717
/site/
18+
uv.lock
1819

1920
# cache
2021
.cache/

.gitpod.dockerfile

-6
This file was deleted.

.gitpod.yml

-13
This file was deleted.

CONTRIBUTING.md

+2-3
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ make setup
2323
> You can install it with:
2424
>
2525
> ```bash
26-
> python3 -m pip install --user pipx
27-
> pipx install uv
26+
> curl -LsSf https://astral.sh/uv/install.sh | sh
2827
> ```
2928
>
3029
> Now you can try running `make setup` again,
31-
> or simply `uv install`.
30+
> or simply `uv sync`.
3231
3332
You now have the dependencies installed.
3433

config/ruff.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
target-version = "py38"
1+
target-version = "py39"
22
line-length = 120
33

44
[lint]

devdeps.txt

-32
This file was deleted.

duties.py

+17-5
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,13 @@
77
from contextlib import contextmanager
88
from importlib.metadata import version as pkgversion
99
from pathlib import Path
10-
from typing import TYPE_CHECKING, Iterator
10+
from typing import TYPE_CHECKING
1111

1212
from duty import duty, tools
1313

1414
if TYPE_CHECKING:
15+
from collections.abc import Iterator
16+
1517
from duty.context import Context
1618

1719

@@ -53,7 +55,7 @@ def changelog(ctx: Context, bump: str = "") -> None:
5355
ctx.run(tools.git_changelog(bump=bump or None), title="Updating changelog")
5456

5557

56-
@duty(pre=["check_quality", "check_types", "check_docs", "check-api"])
58+
@duty(pre=["check-quality", "check-types", "check-docs", "check-api"])
5759
def check(ctx: Context) -> None:
5860
"""Check it all!"""
5961

@@ -116,23 +118,33 @@ def docs(ctx: Context, *cli_args: str, host: str = "127.0.0.1", port: int = 8000
116118

117119

118120
@duty
119-
def docs_deploy(ctx: Context) -> None:
120-
"""Deploy the documentation to GitHub pages."""
121+
def docs_deploy(ctx: Context, *, force: bool = False) -> None:
122+
"""Deploy the documentation to GitHub pages.
123+
124+
Parameters:
125+
force: Whether to force deployment, even from non-Insiders version.
126+
"""
121127
os.environ["DEPLOY"] = "true"
122128
with material_insiders() as insiders:
123129
if not insiders:
124130
ctx.run(lambda: False, title="Not deploying docs without Material for MkDocs Insiders!")
125-
origin = ctx.run("git config --get remote.origin.url", silent=True)
131+
origin = ctx.run("git config --get remote.origin.url", silent=True, allow_overrides=False)
126132
if "pawamoy-insiders/mkdocstrings-python" in origin:
127133
ctx.run(
128134
"git remote add upstream [email protected]:mkdocstrings/python",
129135
silent=True,
130136
nofail=True,
137+
allow_overrides=False,
131138
)
132139
ctx.run(
133140
tools.mkdocs.gh_deploy(remote_name="upstream", force=True),
134141
title="Deploying documentation",
135142
)
143+
elif force:
144+
ctx.run(
145+
tools.mkdocs.gh_deploy(force=True),
146+
title="Deploying documentation",
147+
)
136148
else:
137149
ctx.run(
138150
lambda: False,

mkdocs.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -180,9 +180,10 @@ plugins:
180180
signature_crossrefs: true
181181
summary: true
182182
unwrap_annotated: true
183-
- git-committers:
183+
- git-revision-date-localized:
184184
enabled: !ENV [DEPLOY, false]
185-
repository: mkdocstrings/python
185+
enable_creation_date: true
186+
type: timeago
186187
- minify:
187188
minify_html: !ENV [DEPLOY, false]
188189
- group:

pyproject.toml

+38-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ description = "A Python handler for mkdocstrings."
88
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
99
license = {text = "ISC"}
1010
readme = "README.md"
11-
requires-python = ">=3.8"
11+
requires-python = ">=3.9"
1212
keywords = []
1313
dynamic = ["version"]
1414
classifiers = [
@@ -17,12 +17,12 @@ classifiers = [
1717
"Programming Language :: Python",
1818
"Programming Language :: Python :: 3",
1919
"Programming Language :: Python :: 3 :: Only",
20-
"Programming Language :: Python :: 3.8",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",
2322
"Programming Language :: Python :: 3.11",
2423
"Programming Language :: Python :: 3.12",
2524
"Programming Language :: Python :: 3.13",
25+
"Programming Language :: Python :: 3.14",
2626
"Topic :: Documentation",
2727
"Topic :: Software Development",
2828
"Topic :: Utilities",
@@ -58,7 +58,6 @@ source-includes = [
5858
"scripts",
5959
"share",
6060
"tests",
61-
"devdeps.txt",
6261
"duties.py",
6362
"mkdocs.yml",
6463
"*.md",
@@ -69,3 +68,39 @@ source-includes = [
6968
data = [
7069
{path = "share/**/*", relative-to = "."},
7170
]
71+
72+
[tool.uv]
73+
dev-dependencies = [
74+
# dev
75+
"editables>=0.5",
76+
77+
# maintenance
78+
"build>=1.2",
79+
"git-changelog>=2.5",
80+
"twine>=5.1",
81+
82+
# ci
83+
"duty>=1.4",
84+
"ruff>=0.4",
85+
"pytest>=8.2",
86+
"pytest-cov>=5.0",
87+
"pytest-randomly>=3.15",
88+
"pytest-xdist>=3.6",
89+
"mypy>=1.10",
90+
"types-markdown>=3.6",
91+
"types-pyyaml>=6.0",
92+
93+
# docs
94+
"black>=24.4",
95+
"markdown-callouts>=0.4",
96+
"markdown-exec>=1.8",
97+
"mkdocs>=1.6",
98+
"mkdocs-coverage>=1.0",
99+
"mkdocs-gen-files>=0.5",
100+
"mkdocs-git-revision-date-localized-plugin>=1.2",
101+
"mkdocs-literate-nav>=0.6",
102+
"mkdocs-material>=9.5",
103+
"mkdocs-minify-plugin>=0.8",
104+
# YORE: EOL 3.10: Remove line.
105+
"tomli>=2.0; python_version < '3.11'",
106+
]

scripts/gen_credits.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
import os
66
import sys
77
from collections import defaultdict
8+
from collections.abc import Iterable
89
from importlib.metadata import distributions
910
from itertools import chain
1011
from pathlib import Path
1112
from textwrap import dedent
12-
from typing import Dict, Iterable, Union
13+
from typing import Union
1314

1415
from jinja2 import StrictUndefined
1516
from jinja2.sandbox import SandboxedEnvironment
1617
from packaging.requirements import Requirement
1718

18-
# TODO: Remove once support for Python 3.10 is dropped.
19+
# YORE: EOL 3.10: Replace block with line 2.
1920
if sys.version_info >= (3, 11):
2021
import tomllib
2122
else:
@@ -26,11 +27,10 @@
2627
pyproject = tomllib.load(pyproject_file)
2728
project = pyproject["project"]
2829
project_name = project["name"]
29-
with project_dir.joinpath("devdeps.txt").open() as devdeps_file:
30-
devdeps = [line.strip() for line in devdeps_file if line.strip() and not line.strip().startswith(("-e", "#"))]
30+
devdeps = [dep for dep in pyproject["tool"]["uv"]["dev-dependencies"] if not dep.startswith("-e")]
3131

32-
PackageMetadata = Dict[str, Union[str, Iterable[str]]]
33-
Metadata = Dict[str, PackageMetadata]
32+
PackageMetadata = dict[str, Union[str, Iterable[str]]]
33+
Metadata = dict[str, PackageMetadata]
3434

3535

3636
def _merge_fields(metadata: dict) -> PackageMetadata:

0 commit comments

Comments
 (0)