8000 chore: Template upgrade · hahnbeelee/mkdocstrings-python@c49bde8 · GitHub
[go: up one dir, main page]

Skip to content

Commit c49bde8

Browse files
committed
chore: Template upgrade
1 parent 0817708 commit c49bde8

File tree

16 files changed

+173
-20
lines changed

16 files changed

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

.github/ISSUE_TEMPLATE/bug_report.md renamed to .github/ISSUE_TEMPLATE/1-bug.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ PASTE TRACEBACK HERE
5353
python -m mkdocstrings_handlers.python.debug # | xclip -selection clipboard
5454
```
5555

56-
PASTE OUTPUT HERE
56+
PASTE MARKDOWN OUTPUT HERE
5757

5858
### Additional context
5959
<!-- Add any other relevant context about the problem here,

.github/ISSUE_TEMPLATE/3-docs.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: Documentation update
3+
about: Point at unclear, missing or outdated documentation.
4+
title: "docs: "
5+
labels: docs
6+
assignees: pawamoy
7+
---
8+
9+
### Is something unclear, missing or outdated in our documentation?
10+
<!-- A clear and concise description of what the documentation issue is. Ex. I can't find an explanation on feature [...]. -->
11+
12+
### Relevant code snippets
13+
<!-- If the documentation issue is related to code, please provide relevant code snippets. -->
14+
15+
### Link to the relevant documentation section
16+
<!-- Add a link to the relevant section of our documentation, or any addition context. -->

.github/ISSUE_TEMPLATE/4-change.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
name: Change request
3+
about: Suggest any other kind of change for this project.
4+
title: "change: "
5+
assignees: pawamoy
6+
---
7+
8+
### Is your change request related to a problem? Please describe.
9+
<!-- A clear and concise description of what the problem is. -->
10+
11+
### Describe the solution you'd like
12+
<!-- A clear and concise description of what you want to happen. -->
13+
14+
### Describe alternatives you've considered
15+
<!-- A clear and concise description of any alternative solutions you've considered. -->
16+
17+
### Additional context
18+
<!-- Add any other context or screenshots about the change request here. -->

CONTRIBUTING.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,11 @@ Run `make help` to see all the available actions!
3636
3737
## Tasks
3838
39-
This project uses [duty](https://github.com/pawamoy/duty) to run tasks.
40-
A Makefile is also provided. The Makefile will try to run certain tasks
41-
on multiple Python versions. If for some reason you don't want to run the task
42-
on multiple Python versions, you run the task directly with `make run duty TASK`.
43-
44-
The Makefile detects if a virtual environment is activated,
45-
so `make` will work the same with the virtualenv activated or not.
39+
The entry-point to run commands and tasks is the `make` Python script,
40+
located in the `scripts` directory. Try running `make` to show the available commands and tasks.
41+
The *commands* do not need the Python dependencies to be installed,
42+
while the *tasks* do.
43+
The cross-platform tasks are written in Python, thanks to [duty](https://github.com/pawamoy/duty).
4644
4745
If you work in VSCode, we provide
4846
[an action to configure VSCode](https://pawamoy.github.io/copier-uv/work/#vscode-setup)

devdeps.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ editables>=0.5
44
# maintenance
55
build>=1.2
66
git-changelog>=2.5
7-
twine>=5.1; python_version < '3.13'
7+
twine>=5.0; python_version < '3.13'
88

99
# ci
1010
duty>=1.4

docs/.overrides/main.html

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,19 @@
22

33
{% block announce %}
44

5-
<a href="{{ 'insiders/#how-to-become-a-sponsor' | url }}"><strong>Sponsorship</strong></a>
6-
is now available!
5+
<strong>Fund this project</strong> through
6+
<a href="{{ 'insiders/#how-to-become-a-sponsor' | url }}"><strong>sponsorship</strong></a>
77
<span class="twemoji heart pulse">
88
{% include ".icons/octicons/heart-fill-16.svg" %}
99
</span> &mdash;
1010

11-
For updates follow <strong>@pawamoy</strong> on
11+
Follow
12+
<strong>@pawamoy</strong> on
1213
<a rel="me" href="https://fosstodon.org/@pawamoy">
1314
<span class="twemoji mastodon">
1415
{% include ".icons/fontawesome/brands/mastodon.svg" %}
1516
</span>
1617
<strong>Fosstodon</strong>
1718
</a>
19+
for updates
1820
{% endblock %}
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<!-- Giscus -->
2+
<!-- https://squidfunk.github.io/mkdocs-material/setup/adding-a-comment-system/#giscus-integration -->
3+
<div id="feedback" style="display: none;">
4+
<h2 id="__comments">Feedback</h2>
5+
<script src="https://giscus.app/client.js"
6+
data-repo="mkdocstrings/python"
7+
data-repo-id="R_kgDOGTScxA"
8+
data-category="Documentation"
9+
data-category-id="DIC_kwDOGTScxM4ChLJD"
10+
data-mapping="pathname"
11+
data-strict="1"
12+
data-reactions-enabled="0"
13+
data-emit-metadata="0"
14+
data-input-position="top"
15+
data-theme="preferred_color_scheme"
16+
data-lang="en"
17+
data-loading="lazy"
18+
crossorigin="anonymous"
19+
async>
20+
</script>
21+
22+
<!-- Synchronize Giscus theme with palette -->
23+
<script>
24+
var giscus = document.querySelector("script[src*=giscus]")
25+
26+
// Set palette on initial load
27+
var palette = __md_get("__palette")
28+
if (palette && typeof palette.color === "object") {
29+
var theme = palette.color.scheme === "slate"
30+
? "transparent_dark"
31+
: "light"
32+
33+
// Instruct Giscus to set theme
34+
giscus.setAttribute("data-theme", theme)
35+
}
36+
37+
// Register event handlers after documented loaded
38+
document.addEventListener("DOMContentLoaded", function() {
39+
var ref = document.querySelector("[data-md-component=palette]")
40+
ref.addEventListener("change", function() {
41+
var palette = __md_get("__palette")
42+
if (palette && typeof palette.color === "object") {
43+
var theme = palette.color.scheme === "slate"
44+
? "transparent_dark"
45+
: "light"
46+
47+
// Instruct Giscus to change theme
48+
var frame = document.querySelector(".giscus-frame")
49+
frame.contentWindow.postMessage(
50+
{ giscus: { setConfig: { theme } } },
51+
"https://giscus.app"
52+
)
53+
}
54+
})
55+
})
56+
</script>
57+
</div>

docs/index.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
---
2+
hide:
3+
- feedback
4+
---
5+
16
--8<-- "README.md"

docs/insiders/index.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,10 @@ with your GitHub account, visit [pawamoy's sponsor profile][github sponsor profi
9999
and complete a sponsorship of **$10 a month or more**.
100100
You can use your individual or organization GitHub account for sponsoring.
101101

102+
Sponsorships lower than $10 a month are also very much appreciated, and useful.
103+
They won't grant you access to Insiders, but they will be counted towards reaching sponsorship goals.
104+
*Every* sponsorship helps us implementing new features and releasing them to the public.
105+
102106
**Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
103107
through a GitHub organization, please send a short email
104108
to insiders@pawamoy.fr with the name of your

docs/js/feedback.js

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
const feedback = document.forms.feedback;
2+
feedback.hidden = false;
3+
4+
feedback.addEventListener("submit", function(ev) {
5+
ev.preventDefault();
6+
const commentElement = document.getElementById("feedback");
7+
commentElement.style.display = "block";
8+
feedback.firstElementChild.disabled = true;
9+
const data = ev.submitter.getAttribute("data-md-value");
10+
const note = feedback.querySelector(".md-feedback__note [data-md-value='" + data + "']");
11+
if (note) {
12+
note.hidden = false;
13+
}
14+
})

docs/license.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
---
2+
hide:
3+
- feedback
4+
---
5+
16
# License
27

38
```

mkdocs.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ extra_css:
9393
- css/mkdocstrings.css
9494
- css/insiders.css
9595

96+
extra_javascript:
97+
- js/feedback.js
98+
9699
markdown_extensions:
97100
- abbr
98101
- attr_list
@@ -192,3 +195,15 @@ extra:
192195
link: https://gitter.im/mkdocstrings/python
193196
- icon: fontawesome/brands/python
194197
link: https://pypi.org/project/mkdocstrings-python/
198+
analytics:
199+
feedback:
200+
title: Was this page helpful?
201+
ratings:
202+
- icon: material/emoticon-happy-outline
203+
name: This page was helpful
204+
data: 1
205+
note: Thanks for your feedback!
206+
- icon: material/emoticon-sad-outline
207+
name: This page could be improved
208+
data: 0
209+
note: Let us know how we can improve this page.

pyproject.toml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,19 @@ version = {source = "scm"}
5050
package-dir = "src"
5151
includes = ["src/mkdocstrings_handlers"]
5252
editable-backend = "editables"
53-
source-includes = ["share"]
53+
excludes = ["**/.pytest_cache"]
54+
source-includes = [
55+
"config",
56+
"docs",
57+
"scripts",
58+
"share",
59+
"tests",
60+
"devdeps.txt",
61+
"duties.py",
62+
"mkdocs.yml",
63+
"*.md",
64+
"LICENSE",
65+
]
5466

5567
[tool.pdm.build.wheel-data]
5668
data = [

scripts/make

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#!/usr/bin/env python3
22
"""Management commands."""
33

4+
from __future__ import annotations
5+
46
import os
57
import shutil
68
import subprocess
@@ -15,9 +17,12 @@ exe = ""
1517
prefix = ""
1618

1719

18-
def shell(cmd: str) -> None:
20+
def shell(cmd: str, capture_output: bool = False, **kwargs: Any) -> str | None:
1921
"""Run a shell command."""
20-
subprocess.run(cmd, shell=True, check=True) # noqa: S602
22+
if capture_output:
23+
return subprocess.check_output(cmd, shell=True, text=True, **kwargs) # noqa: S602
24+
subprocess.run(cmd, shell=True, check=True, stderr=subprocess.STDOUT, **kwargs) # noqa: S602
25+
return None
2126

2227

2328
@contextmanager
@@ -37,8 +42,8 @@ def uv_install() -> None:
3742
uv_opts = ""
3843
if "UV_RESOLUTION" in os.environ:
3944
uv_opts = f"--resolution={os.getenv('UV_RESOLUTION')}"
40-
cmd = f"uv pip compile {uv_opts} pyproject.toml devdeps.txt | uv pip install -r -"
41-
shell(cmd)
45+
requirements = shell(f"uv pip compile {uv_opts} pyproject.toml devdeps.txt", capture_output=True)
46+
shell("uv pip install -r -", input=requirements, text=True)
4247
if "CI" not in os.environ:
4348
shell("uv pip install --no-deps -e .")
4449
else:
@@ -199,5 +204,7 @@ def main() -> int:
199204
if __name__ == "__main__":
200205
try:
201206
sys.exit(main())
202-
except Exception: # noqa: BLE001
203-
sys.exit(1)
207+
except subprocess.CalledProcessError as process:
208+
if process.output:
209+
print(process.output, file=sys.stderr) # noqa: T201
210+
sys.exit(process.returncode)

0 commit comments

Comments
 (0)
0