Skip to content

Commit 028a802

Browse files
committed
chore: Template upgrade
1 parent ca78588 commit 028a802

12 files changed

Lines changed: 107 additions & 38 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.15.2
2+
_commit: 0.15.7
33
_src_path: gh:pawamoy/copier-pdm.git
44
author_email: pawamoy@pm.me
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,10 +32,10 @@ jobs:
3232
python-version: "3.8"
3333

3434
- name: Resolving dependencies
35-
run: pdm lock -v
35+
run: pdm lock -v --no-cross-platform -G ci-quality
3636

3737
- name: Install dependencies
38-
run: pdm install -G duty -G docs -G quality -G typing -G security
38+
run: pdm install -G ci-quality
3939

4040
- name: Check if the documentation builds correctly
4141
run: pdm run duty check-docs
@@ -55,6 +55,7 @@ jobs:
5555
tests:
5656

5757
strategy:
58+
max-parallel: 4
5859
matrix:
5960
os:
6061
- ubuntu-latest
@@ -79,10 +80,10 @@ jobs:
7980
python-version: ${{ matrix.python-version }}
8081

8182
- name: Resolving dependencies
82-
run: pdm lock -v
83+
run: pdm lock -v --no-cross-platform -G ci-tests
8384

8485
- name: Install dependencies
85-
run: pdm install --no-editable -G duty -G tests -G docs
86+
run: pdm install --no-editable -G ci-tests
8687

8788
- name: Run the test suite
8889
run: pdm run duty test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ pip-wheel-metadata/
1212
site/
1313
pdm.lock
1414
pdm.toml
15+
.pdm-plugins/
1516
.pdm-python
1617
__pypackages__/
1718
.mypy_cache/

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ help:
3232

3333
.PHONY: lock
3434
lock:
35-
@pdm lock
35+
@pdm lock --dev
3636

3737
.PHONY: setup
3838
setup:

docs/.overrides/main.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@
66
is now available!
77
<span class="twemoji heart pulse">
88
{% include ".icons/octicons/heart-fill-16.svg" %}
9-
</span>
9+
</span> &mdash;
1010

11-
&mdash; For updates follow <strong>@pawamoy</strong> on
11+
For updates follow <strong>@pawamoy</strong> on
1212
<a rel="me" href="https://fosstodon.org/@pawamoy">
1313
<span class="twemoji mastodon">
1414
{% include ".icons/fontawesome/brands/mastodon.svg" %}

docs/css/mkdocstrings.css

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,30 @@ div.doc-contents:not(.first) {
44
border-left: .05rem solid var(--md-typeset-table-color);
55
}
66

7+
/* Mark external links as such. */
8+
a.autorefs-external::after {
9+
/* https://primer.style/octicons/arrow-up-right-24 */
10+
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path fill="rgb(0, 0, 0)" d="M18.25 15.5a.75.75 0 00.75-.75v-9a.75.75 0 00-.75-.75h-9a.75.75 0 000 1.5h7.19L6.22 16.72a.75.75 0 101.06 1.06L17.5 7.56v7.19c0 .414.336.75.75.75z"></path></svg>');
11+
content: ' ';
12+
13+
display: inline-block;
14+
vertical-align: middle;
15+
position: relative;
16+
bottom: 0.1em;
17+
margin-left: 0.2em;
18+
margin-right: 0.1em;
19+
20+
height: 0.7em;
21+
width: 0.7em;
22+
border-radius: 100%;
23+
background-color: var(--md-typeset-a-color);
24+
}
25+
26+
a.autorefs-external:hover::after {
27+
background-color: var(--md-accent-fg-color);
28+
}
29+
730
/* Avoid breaking parameters name, etc. in table cells. */
831
td code {
932
word-break: normal !important;
10-
}
33+
}

duties.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
import os
66
import sys
77
from pathlib import Path
8-
from typing import TYPE_CHECKING
8+
from typing import TYPE_CHECKING, Any
99

1010
from duty import duty
1111
from duty.callables import black, blacken_docs, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
@@ -35,7 +35,29 @@ def pyprefix(title: str) -> str: # noqa: D103
3535
return title
3636

3737

38+
def merge(d1: Any, d2: Any) -> Any: # noqa: D103
39+
basic_types = (int, float, str, bool, complex)
40+
if isinstance(d1, dict) and isinstance(d2, dict):
41+
for key, value in d2.items():
42+
if key in d1:
43+
if isinstance(d1[key], basic_types):
44+
d1[key] = value
45+
else:
46+
d1[key] = merge(d1[key], value)
47+
else:
48+
d1[key] = value
49+
return d1
50+
if isinstance(d1, list) and isinstance(d2, list):
51+
return d1 + d2
52+
return d2
53+
54+
3855
def mkdocs_config() -> str: # noqa: D103
56+
from mkdocs import utils
57+
58+
# patch YAML loader to merge arrays
59+
utils.merge = merge
60+
3961
if "+insiders" in pkgversion("mkdocs-material"):
4062
return "mkdocs.insiders.yml"
4163
return "mkdocs.yml"

mkdocs.insiders.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ INHERIT: mkdocs.yml
22

33
# waiting for https://github.com/squidfunk/mkdocs-material/issues/5446
44
# plugins:
5-
# typeset: {}
5+
# - typeset

mkdocs.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -108,15 +108,15 @@ markdown_extensions:
108108
permalink: "¤"
109109

110110
plugins:
111-
search: {}
112-
markdown-exec: {}
113-
gen-files:
111+
- search
112+
- markdown-exec
113+
- gen-files:
114114
scripts:
115115
- scripts/gen_ref_nav.py
116-
literate-nav:
116+
- literate-nav:
117117
nav_file: SUMMARY.txt
118-
coverage: {}
119-
mkdocstrings:
118+
- coverage
119+
- mkdocstrings:
120120
handlers:
121121
python:
122122
import:
@@ -128,14 +128,14 @@ plugins:
128128
merge_init_into_class: true
129129
docstring_options:
130130
ignore_init_summary: true
131-
git-committers:
131+
- git-committers:
132132
enabled: !ENV [DEPLOY, false]
133133
repository: mkdocstrings/mkdocstrings
134-
redirects:
134+
- redirects:
135135
redirect_maps:
136136
theming.md: usage/theming.md
137137
handlers/overview.md: usage/handlers.md
138-
minify:
138+
- minify:
139139
minify_html: !ENV [DEPLOY, false]
140140

141141
extra:

pyproject.toml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ mkdocstrings = "mkdocstrings.plugin:MkdocstringsPlugin"
5858

5959
[tool.pdm]
6060
version = {source = "scm"}
61+
plugins = [
62+
"pdm-multirun",
63+
]
6164

6265
[tool.pdm.build]
6366
package-dir = "src"
@@ -66,6 +69,8 @@ editable-backend = "editables"
6669

6770
[tool.pdm.dev-dependencies]
6871
duty = ["duty>=0.10"]
72+
ci-quality = ["mkdocstrings[duty,docs,quality,typing,security]"]
73+
ci-tests = ["mkdocstrings[duty,docs,tests]"]
6974
docs = [
7075
"black>=23.1",
7176
"markdown-callouts>=0.2",
@@ -105,4 +110,6 @@ typing = [
105110
"types-pyyaml>=6.0",
106111
"types-toml>=0.10",
107112
]
108-
security = ["safety>=2"]
113+
security = [
114+
"safety>=2",
115+
]

0 commit comments

Comments
 (0)