Skip to content

Commit 6d60023

Browse files
committed
chore: Template upgrade
1 parent be7d65d commit 6d60023

File tree

13 files changed

+153
-35
lines changed

13 files changed

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

.github/pull_request_template.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
### For reviewers
2+
<!-- Help reviewers by letting them know whether AI was used to create this PR. -->
3+
4+
- [ ] I did not use AI
5+
- [ ] I used AI and thoroughly reviewed every code/docs change
6+
7+
### Description of the change
8+
<!-- Quick sentence for small changes, longer description for more impacting changes. -->
9+
10+
### Relevant resources
11+
<!-- Link to any relevant GitHub issue, PR or discussion, section in online docs, etc. -->
12+
13+
-
14+
-
15+
-

.github/workflows/ci.yml

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,17 @@ name: ci
22

33
on:
44
push:
5+
branches:
6+
- main
7+
- test-me-*
58
pull_request:
69
branches:
710
- main
811

12+
concurrency:
13+
group: ${{ github.workflow }}-${{ github.ref }}
14+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
15+
916
defaults:
1017
run:
1118
shell: bash
@@ -14,13 +21,30 @@ env:
1421
LANG: en_US.utf-8
1522
LC_ALL: en_US.utf-8
1623
PYTHONIOENCODING: UTF-8
24+
PYTHONWARNDEFAULTENCODING: "1"
1725
PYTHON_VERSIONS: ""
1826

1927
jobs:
2028

2129
quality:
30+
strategy:
31+
matrix:
32+
os:
33+
- ubuntu-latest
34+
- macos-latest
35+
- windows-latest
36+
python-version:
37+
- "3.9"
38+
- "3.13"
39+
include:
40+
- os: ubuntu-latest
41+
python-version: "3.10"
42+
- os: ubuntu-latest
43+
python-version: "3.11"
44+
- os: ubuntu-latest
45+
python-version: "3.12"
2246

23-
runs-on: ubuntu-latest
47+
runs-on: ${{ matrix.os }}
2448

2549
steps:
2650
- name: Checkout
@@ -32,7 +56,7 @@ jobs:
3256
- name: Setup Python
3357
uses: actions/setup-python@v5
3458
with:
35-
python-version: "3.13"
59+
python-version: ${{ matrix.python-version }}
3660

3761
- name: Setup uv
3862
uses: astral-sh/setup-uv@v5
@@ -109,7 +133,7 @@ jobs:
109133
- lowest-direct
110134
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
111135
runs-on: ${{ matrix.os }}
112-
continue-on-error: ${{ matrix.python-version == '3.14' }}
136+
continue-on-error: true
113137

114138
steps:
115139
- name: Checkout

Makefile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
# the `make` command will point at the `scripts/make` shell script.
33
# This Makefile is just here to allow auto-completion in the terminal.
44

5+
default: help
6+
@echo
7+
@echo 'Enable direnv in your shell to use the `make` command: `direnv allow`'
8+
@echo 'Or use `python scripts/make ARGS` to run the commands/tasks directly.'
9+
10+
.DEFAULT_GOAL: default
11+
512
actions = \
613
allrun \
714
changelog \

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
[![ci](https://github.com/mkdocstrings/python/workflows/ci/badge.svg)](https://github.com/mkdocstrings/python/actions?query=workflow%3Aci)
66
[![documentation](https://img.shields.io/badge/docs-mkdocs-708FCC.svg?style=flat)](https://mkdocstrings.github.io/python/)
77
[![pypi version](https://img.shields.io/pypi/v/mkdocstrings-python.svg)](https://pypi.org/project/mkdocstrings-python/)
8-
[![gitter](https://badges.gitter.im/join%20chat.svg)](https://app.gitter.im/#/room/#python:gitter.im)
8+
[![gitter](https://img.shields.io/badge/matrix-chat-4DB798.svg?style=flat)](https://app.gitter.im/#/room/#mkdocstrings_python:gitter.im)
99

1010
---
1111

config/pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ testpaths =
1010
# action:message_regex:warning_class:module_regex:line
1111
filterwarnings =
1212
error
13+
default::EncodingWarning
14+
error::EncodingWarning:python
1315
# TODO: Remove once pytest-xdist 4 is released.
1416
ignore:.*rsyncdir:DeprecationWarning:xdist
1517
# TODO: Remove once mkdocstrings stops setting fallback function.

config/pytest_39.ini

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# YORE: EOL 3.9: Remove file.
2+
# This file is used on 3.9 due to forward compatibility issue with filterwarnings.
3+
# See https://github.com/pytest-dev/pytest/issues/11101.
4+
[pytest]
5+
python_files =
6+
test_*.py
7+
addopts =
8+
--cov
9+
--cov-config config/coverage.ini
10+
testpaths =
11+
tests
12+
13+
# action:message_regex:warning_class:module_regex:line
14+
filterwarnings =
15+
error
16+
# TODO: remove once pytest-xdist 4 is released
17+
ignore:.*rsyncdir:DeprecationWarning:xdist

docs/js/insiders.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,14 @@ function updatePremiumSponsors(dataURL, rank) {
2929
let html = '';
3030
html += `<b>${capRank} sponsors</b><p>`
3131
sponsors.forEach(function (sponsor) {
32-
html += `
33-
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
34-
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
35-
</a>
36-
`
32+
html += `<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">`
33+
if (sponsor.image) {
34+
html += `<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">`
35+
} else if (sponsor.imageLight && sponsor.imageDark) {
36+
html += `<img alt="${sponsor.name}" src="${sponsor.imageLight}#only-light" style="height: ${sponsor.imageHeight}px;">`
37+
html += `<img alt="${sponsor.name}" src="${sponsor.imageDark}#only-dark" style="height: ${sponsor.imageHeight}px;">`
38+
}
39+
html += '</a>';
3740
});
3841
html += '</p>'
3942
sponsorsDiv.innerHTML = html;

duties.py

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
WINDOWS = os.name == "nt"
2727
PTY = not WINDOWS and not CI
2828
MULTIRUN = os.environ.get("MULTIRUN", "0") == "1"
29+
PY_VERSION = f"{sys.version_info.major}{sys.version_info.minor}"
30+
PY_DEV = "314"
2931

3032

3133
def pyprefix(title: str) -> str:
@@ -84,7 +86,7 @@ def check(ctx: Context) -> None:
8486
"""Check it all!"""
8587

8688

87-
@duty
89+
@duty(nofail=PY_VERSION == PY_DEV)
8890
def check_quality(ctx: Context) -> None:
8991
"""Check the code quality."""
9092
ctx.run(
@@ -93,7 +95,7 @@ def check_quality(ctx: Context) -> None:
9395
)
9496

9597

96-
@duty(skip_if=sys.version_info < (3, 13), skip_reason=pyprefix("Skipped: docs require modern generics syntax"))
98+
@duty(nofail=PY_VERSION == PY_DEV, skip_if=sys.version_info < (3, 13), skip_reason=pyprefix("Skipped: docs require modern generics syntax"))
9799
def check_docs(ctx: Context) -> None:
98100
"""Check if the documentation builds correctly."""
99101
Path("htmlcov").mkdir(parents=True, exist_ok=True)
@@ -105,7 +107,7 @@ def check_docs(ctx: Context) -> None:
105107
)
106108

107109

108-
@duty
110+
@duty(nofail=PY_VERSION == PY_DEV)
109111
def check_types(ctx: Context) -> None:
110112
"""Check that the code is correctly typed."""
111113
os.environ["MYPYPATH"] = "src"
@@ -118,7 +120,7 @@ def check_types(ctx: Context) -> None:
118120
)
119121

120122

121-
@duty
123+
@duty(nofail=PY_VERSION == PY_DEV)
122124
def check_api(ctx: Context, *cli_args: str) -> None:
123125
"""Check for API breaking changes."""
124126
ctx.run(
@@ -239,25 +241,31 @@ def coverage(ctx: Context) -> None:
239241
ctx.run(tools.coverage.html(rcfile="config/coverage.ini"))
240242

241243

242-
@duty
244+
@duty(nofail=PY_VERSION == PY_DEV)
243245
def test(ctx: Context, *cli_args: str, match: str = "", snapshot: str = "report") -> None: # noqa: PT028
244246
"""Run the test suite.
245247
246248
Parameters:
247249
match: A pytest expression to filter selected tests.
248250
snapshot: Whether to "create", "fix", "trim", or "update" snapshots.
249251
"""
250-
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
251-
os.environ["COVERAGE_FILE"] = f".coverage.{py_version}"
252+
os.environ["COVERAGE_FILE"] = f".coverage.{PY_VERSION}"
253+
os.environ["PYTHONWARNDEFAULTENCODING"] = "1"
252254
args = list(cli_args)
253255
if snapshot == "disable" or not snapshot:
254256
args = ["-n", "auto", "--inline-snapshot=disable"]
255257
else:
256258
args = [f"--inline-snapshot={snapshot}"]
259+
260+
config_file = "config/pytest.ini"
261+
# YORE: EOL 3.9: Remove block.
262+
if sys.version_info[:2] < (3, 10):
263+
config_file = "config/pytest_39.ini"
264+
257265
ctx.run(
258266
tools.pytest(
259267
"tests",
260-
config_file="config/pytest.ini",
268+
config_file=config_file,
261269
select=match,
262270
color="yes",
263271
).add_args(*args),

scripts/get_version.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from contextlib import suppress
55
from pathlib import Path
66

7-
from pdm.backend.hooks.version import SCMVersion, Version, default_version_formatter, get_version_from_scm
7+
from pdm.backend.hooks.version import ( # ty: ignore[unresolved-import]
8+
SCMVersion,
9+
Version,
10+
default_version_formatter,
11+
get_version_from_scm,
12+
)
813

914
_root = Path(__file__).parent.parent
1015
_changelog = _root / "CHANGELOG.md"

0 commit comments

Comments
 (0)