Skip to content

Commit 3df7551

Browse files
committed
chore: Template upgrade
1 parent e68bb4c commit 3df7551

9 files changed

Lines changed: 49 additions & 36 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: 0.3.1
2+
_commit: 1.0.0
33
_src_path: gh:mkdocstrings/handler-template
44
author_email: dev@pawamoy.fr
55
author_fullname: Timothée Mazzucotelli

.github/FUNDING.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
github: pawamoy
22
ko_fi: pawamoy
3+
polar: pawamoy
34
custom:
45
- https://www.paypal.me/pawamoy

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -108,10 +108,7 @@ jobs:
108108
run: pip install uv
109109

110110
- name: Install dependencies
111-
run: |
112-
uv venv
113-
uv pip install -r devdeps.txt
114-
uv pip install "mkdocstrings-typescript @ ."
111+
run: make setup
115112

116113
- name: Run the test suite
117114
run: make test

.gitignore

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
1+
# editors
12
.idea/
23
.vscode/
3-
__pycache__/
4-
*.py[cod]
5-
dist/
4+
5+
# python
66
*.egg-info/
7-
build/
8-
htmlcov/
7+
*.py[cod]
8+
.venv/
9+
.venvs/
10+
/build/
11+
/dist/
12+
13+
# tools
914
.coverage*
10-
pip-wheel-metadata/
15+
/.pdm-build/
16+
/htmlcov/
17+
/site/
18+
19+
# cache
20+
.cache/
1121
.pytest_cache/
1222
.mypy_cache/
1323
.ruff_cache/
14-
site/
15-
.venv/
16-
.venvs/
17-
.cache/
24+
__pycache__/

config/ruff.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@ line-length = 120
33

44
[lint]
55
exclude = [
6-
"fixtures",
7-
"site",
6+
"tests/fixtures/*.py",
87
]
98
select = [
109
"A", "ANN", "ARG",
@@ -78,5 +77,8 @@ known-first-party = ["mkdocstrings_handlers.typescript"]
7877
convention = "google"
7978

8079
[format]
80+
exclude = [
81+
"tests/fixtures/*.py",
82+
]
8183
docstring-code-format = true
8284
docstring-code-line-length = 80

duties.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -157,17 +157,16 @@ def clean(ctx: Context) -> None:
157157
Parameters:
158158
ctx: The context instance (passed automatically).
159159
"""
160-
ctx.run("rm -rf .coverage*")
161-
ctx.run("rm -rf .mypy_cache")
162-
ctx.run("rm -rf .pytest_cache")
163-
ctx.run("rm -rf tests/.pytest_cache")
164-
ctx.run("rm -rf build")
165-
ctx.run("rm -rf dist")
166-
ctx.run("rm -rf htmlcov")
167-
ctx.run("rm -rf pip-wheel-metadata")
168-
ctx.run("rm -rf site")
169-
ctx.run("find . -type d -name __pycache__ | xargs rm -rf")
170-
ctx.run("find . -name '*.rej' -delete")
160+
def _rm(*targets: str) -> None:
161+
for target in targets:
162+
ctx.run(f"rm -rf {target}")
163+
164+
def _find_rm(*targets: str) -> None:
165+
for target in targets:
166+
ctx.run(f"find . -type d -name '{target}' | xargs rm -rf")
167+
168+
_rm("build", "dist", ".coverage*", "htmlcov", "site", ".pdm-build")
169+
_find_rm(".cache", ".pytest_cache", ".mypy_cache", ".ruff_cache", "__pycache__")
171170

172171

173172
@duty

scripts/gen_credits.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,12 @@ def _render_credits() -> str:
141141
142142
These projects were used to build *{{ project_name }}*. **Thank you!**
143143
144-
[`python`](https://www.python.org/) |
145-
[`uv`](https://github.com/astral-sh/uv) |
146-
[`copier-uv`](https://github.com/pawamoy/copier-uv)
144+
[Python](https://www.python.org/) |
145+
[uv](https://github.com/astral-sh/uv) |
146+
[copier-uv](https://github.com/pawamoy/copier-uv)
147147
148148
{% macro dep_line(dep) -%}
149-
[`{{ dep.name }}`](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec|sort(reverse=True)|join(", ") ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
149+
[{{ dep.name }}](https://pypi.org/project/{{ dep.name }}/) | {{ dep.summary }} | {{ ("`" ~ dep.spec|sort(reverse=True)|join(", ") ~ "`") if dep.spec else "" }} | `{{ dep.version }}` | {{ dep.license }}
150150
{%- endmacro %}
151151
152152
{% if prod_dependencies -%}

scripts/make

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,11 @@ prefix=""
1111
# as well as current project in editable mode.
1212
uv_install() {
1313
uv pip compile pyproject.toml devdeps.txt | uv pip install -r -
14-
uv pip install -e .
14+
if [ -z "${CI}" ]; then
15+
uv pip install -e .
16+
else
17+
uv pip install "mkdocstrings-typescript @ ."
18+
fi
1519
}
1620

1721

@@ -28,13 +32,13 @@ setup() {
2832
if [ -n "${PYTHON_VERSIONS}" ]; then
2933
for version in ${PYTHON_VERSIONS}; do
3034
if [ ! -d ".venvs/${version}" ]; then
31-
uv venv --seed --python "${version}" ".venvs/${version}"
35+
uv venv --python "${version}" ".venvs/${version}"
3236
fi
3337
VIRTUAL_ENV="${PWD}/.venvs/${version}" uv_install
3438
done
3539
fi
3640

37-
if [ ! -d .venv ]; then uv venv --seed --python python; fi
41+
if [ ! -d .venv ]; then uv venv --python python; fi
3842
uv_install
3943
}
4044

src/mkdocstrings_handlers/typescript/debug.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ class Environment:
3737
"""Python interpreter name."""
3838
interpreter_version: str
3939
"""Python interpreter version."""
40+
interpreter_path: str
41+
"""Path to Python executable."""
4042
platform: str
4143
"""Operating System."""
4244
packages: list[Package]
@@ -83,6 +85,7 @@ def get_debug_info() -> Environment:
8385
return Environment(
8486
interpreter_name=py_name,
8587
interpreter_version=py_version,
88+
interpreter_path=sys.executable,
8689
platform=platform.platform(),
8790
variables=[Variable(var, val) for var in variables if (val := os.getenv(var))],
8891
packages=[Package(pkg, get_version(pkg)) for pkg in packages],
@@ -93,7 +96,7 @@ def print_debug_info() -> None:
9396
"""Print debug/environment information."""
9497
info = get_debug_info()
9598
print(f"- __System__: {info.platform}")
96-
print(f"- __Python__: {info.interpreter_name} {info.interpreter_version}")
99+
print(f"- __Python__: {info.interpreter_name} {info.interpreter_version} ({info.interpreter_path})")
97100
print("- __Environment variables__:")
98101
for var in info.variables:
99102
print(f" - `{var.name}`: `{var.value}`")

0 commit comments

Comments
 (0)