Skip to content

Commit b9f0e95

Browse files
committed
chore: Template upgrade
1 parent adff40b commit b9f0e95

File tree

15 files changed

+86
-53
lines changed

15 files changed

+86
-53
lines changed

.copier-answers.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
# Changes here will be overwritten by Copier
2-
_commit: 1.1.3
2+
_commit: 1.2.6
33
_src_path: gh:pawamoy/copier-pdm
4-
author_email: [email protected]
4+
author_email: [email protected]
55
author_fullname: Timothée Mazzucotelli
66
author_username: pawamoy
77
copyright_date: '2022'
88
copyright_holder: Timothée Mazzucotelli
9-
copyright_holder_email: [email protected]
9+
copyright_holder_email: [email protected]
1010
copyright_license: ISC License
1111
insiders: true
12+
insiders_email: [email protected]
1213
insiders_repository_name: markdown-exec
1314
project_description: Utilities to execute code blocks in Markdown files.
1415
project_name: Markdown Exec

.github/workflows/ci.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
steps:
2525
- name: Checkout
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727

2828
- name: Fetch all tags
2929
run: git fetch --depth=1 --tags
@@ -32,7 +32,7 @@ jobs:
3232
uses: ts-graphviz/setup-graphviz@v1
3333

3434
- name: Set up PDM
35-
uses: pdm-project/setup-pdm@v3
35+
uses: pdm-project/setup-pdm@v4
3636
with:
3737
python-version: "3.8"
3838

@@ -99,10 +99,10 @@ jobs:
9999

100100
steps:
101101
- name: Checkout
102-
uses: actions/checkout@v3
102+
uses: actions/checkout@v4
103103

104104
- name: Set up PDM
105-
uses: pdm-project/setup-pdm@v3
105+
uses: pdm-project/setup-pdm@v4
106106
with:
107107
python-version: ${{ matrix.python-version }}
108108
allow-python-prereleases: true

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: startsWith(github.ref, 'refs/tags/')
1111
steps:
1212
- name: Checkout
13-
uses: actions/checkout@v3
13+
uses: actions/checkout@v4
1414
- name: Fetch all tags
1515
run: git fetch --depth=1 --tags
1616
- name: Setup Python
@@ -22,7 +22,7 @@ jobs:
2222
if: github.repository_owner == 'pawamoy-insiders'
2323
run: python -m build
2424
- name: Upload dists artifact
25-
uses: actions/upload-artifact@v3
25+
uses: actions/upload-artifact@v4
2626
if: github.repository_owner == 'pawamoy-insiders'
2727
with:
2828
name: markdown-exec-insiders

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
.idea/
2+
.vscode/
23
__pycache__/
34
*.py[cod]
45
dist/

CODE_OF_CONDUCT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ representative at an online or offline event.
6060

6161
Instances of abusive, harassing, or otherwise unacceptable behavior may be
6262
reported to the community leaders responsible for enforcement at
63-
63+
6464
All complaints will be reviewed and investigated promptly and fairly.
6565

6666
All community leaders are obligated to respect the privacy and security of the

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
SHELL := bash
33
DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
44
export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11 3.12
5+
export PDM_MULTIRUN_USE_VENVS ?= $(if $(shell pdm config python.use_venv | grep True),1,0)
56

67
args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
78
check_quality_args = files

config/ruff.toml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
target-version = "py38"
2-
line-length = 132
2+
line-length = 120
33
exclude = [
44
"fixtures",
55
"site",
@@ -102,3 +102,7 @@ known-first-party = ["markdown_exec"]
102102

103103
[pydocstyle]
104104
convention = "google"
105+
106+
[format]
107+
docstring-code-format = true
108+
docstring-code-line-length = 80

config/vscode/launch.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
"configurations": [
44
{
55
"name": "python (current file)",
6-
"type": "python",
6+
"type": "debugpy",
77
"request": "launch",
88
"program": "${file}",
99
"console": "integratedTerminal",
1010
"justMyCode": false
1111
},
1212
{
1313
"name": "test",
14-
"type": "python",
14+
"type": "debugpy",
1515
"request": "launch",
1616
"module": "pytest",
1717
"justMyCode": false,

docs/insiders/index.md

Lines changed: 29 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -60,17 +60,31 @@ data_source = "docs/insiders/goals.yml"
6060
```
6161

6262
<!-- blacken-docs:off -->
63-
```python exec="1" session="insiders"
63+
```python exec="1" session="insiders" idprefix=""
6464
--8<-- "scripts/insiders.py"
6565

66-
print(
67-
f"""The moment you <a href="#how-to-become-a-sponsor">become a sponsor</a>, you'll get **immediate
68-
access to {len(unreleased_features)} additional features** that you can start using right away, and
69-
which are currently exclusively available to sponsors:\n"""
70-
)
71-
72-
for feature in unreleased_features:
73-
feature.render(badge=True)
66+
if unreleased_features:
67+
print(
68+
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get **immediate "
69+
f"access to {len(unreleased_features)} additional features** that you can start using right away, and "
70+
"which are currently exclusively available to sponsors:\n"
71+
)
72+
73+
for feature in unreleased_features:
74+
feature.render(badge=True)
75+
76+
print(
77+
"\n\nThese are just the features related to this project. "
78+
"[See the complete feature list on the author's main Insiders page](https://pawamoy.github.io/insiders/#whats-in-it-for-me)."
79+
)
80+
else:
81+
print(
82+
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get immediate "
83+
"access to all released features that you can start using right away, and "
84+
"which are exclusively available to sponsors. At this moment, there are no "
85+
"Insiders features for this project, but checkout the [next funding goals](#goals) "
86+
"to see what's coming, as well as **[the feature list for all Insiders projects](https://pawamoy.github.io/insiders/#whats-in-it-for-me).**"
87+
)
7488
```
7589
<!-- blacken-docs:on -->
7690

@@ -83,7 +97,7 @@ You can use your individual or organization GitHub account for sponsoring.
8397

8498
**Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
8599
through a GitHub organization, please send a short email
86-
to [email protected] with the name of your
100+
to [email protected] with the name of your
87101
organization and the GitHub account of the individual
88102
that should be added as a collaborator.[^4]
89103

@@ -92,7 +106,7 @@ You can cancel your sponsorship anytime.[^5]
92106
[^4]:
93107
It's currently not possible to grant access to each member of an
94108
organization, as GitHub only allows for adding users. Thus, after
95-
sponsoring, please send an email to [email protected], stating which
109+
sponsoring, please send an email to [email protected], stating which
96110
account should become a collaborator of the Insiders repository. We're
97111
working on a solution which will make access to organizations much simpler.
98112
To ensure that access is not tied to a particular individual GitHub account,
@@ -116,11 +130,10 @@ You can cancel your sponsorship anytime.[^5]
116130

117131
<hr>
118132
<div class="premium-sponsors">
119-
120-
<div id="bronze-sponsors"></div>
121-
133+
<div id="gold-sponsors"></div>
134+
<div id="silver-sponsors"></div>
135+
<div id="bronze-sponsors"></div>
122136
</div>
123-
124137
<hr>
125138

126139
<div id="sponsors"></div>
@@ -176,8 +189,6 @@ feature flags. Most Insiders features enhance the overall experience,
176189
though while these features add value for the users of your project, they
177190
shouldn't be necessary for previewing when making changes to content.
178191

179-
180-
181192
### Payment
182193

183194
> We don't want to pay for sponsorship every month. Are there any other options?
@@ -187,7 +198,7 @@ yearly billing cycle][billing cycle]. If for some reason you cannot do that, you
187198
could also create a dedicated GitHub account with a yearly billing cycle, which
188199
you only use for sponsoring (some sponsors already do that).
189200

190-
If you have any problems or further questions, please reach out to [email protected].
201+
If you have any problems or further questions, please reach out to [email protected].
191202

192203
### Terms
193204

docs/js/insiders.js

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,26 @@ function getJSON(url, callback) {
2121
xhr.send();
2222
}
2323

24+
function updatePremiumSponsors(dataURL, rank) {
25+
let capRank = rank.charAt(0).toUpperCase() + rank.slice(1);
26+
getJSON(dataURL + `/sponsors${capRank}.json`, function (err, sponsors) {
27+
const sponsorsDiv = document.getElementById(`${rank}-sponsors`);
28+
if (sponsors.length > 0) {
29+
let html = '';
30+
html += `<b>${capRank} sponsors</b><p>`
31+
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+
`
37+
});
38+
html += '</p>'
39+
sponsorsDiv.innerHTML = html;
40+
}
41+
});
42+
}
43+
2444
function updateInsidersPage(author_username) {
2545
const sponsorURL = `https://github.com/sponsors/${author_username}`
2646
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
@@ -48,20 +68,7 @@ function updateInsidersPage(author_username) {
4868
}
4969
});
5070
});
51-
getJSON(dataURL + '/sponsorsBronze.json', function (err, sponsors) {
52-
const bronzeSponsors = document.getElementById("bronze-sponsors");
53-
if (sponsors) {
54-
let html = '';
55-
html += '<b>Bronze sponsors</b><p>'
56-
sponsors.forEach(function (sponsor) {
57-
html += `
58-
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
59-
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
60-
</a>
61-
`
62-
});
63-
html += '</p>'
64-
bronzeSponsors.innerHTML = html;
65-
}
66-
});
71+
updatePremiumSponsors(dataURL, "gold");
72+
updatePremiumSponsors(dataURL, "silver");
73+
updatePremiumSponsors(dataURL, "bronze");
6774
}

duties.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from typing import TYPE_CHECKING, Iterator
1111

1212
from duty import duty
13-
from duty.callables import black, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
13+
from duty.callables import coverage, lazy, mkdocs, mypy, pytest, ruff, safety
1414

1515
if TYPE_CHECKING:
1616
from duty.context import Context
@@ -227,7 +227,7 @@ def format(ctx: Context) -> None:
227227
ruff.check(*PY_SRC_LIST, config="config/ruff.toml", fix_only=True, exit_zero=True),
228228
title="Auto-fixing code",
229229
)
230-
ctx.run(black.run(*PY_SRC_LIST, config="config/black.toml"), title="Formatting code")
230+
ctx.run(ruff.format(*PY_SRC_LIST, config="config/ruff.toml"), title="Formatting code")
231231

232232

233233
@duty(post=["docs-deploy"])

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ build-backend = "pdm.backend"
55
[project]
66
name = "markdown-exec"
77
description = "Utilities to execute code blocks in Markdown files."
8-
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
8+
authors = [{name = "Timothée Mazzucotelli", email = "[email protected]"}]
99
license = {text = "ISC"}
1010
readme = "README.md"
1111
requires-python = ">=3.8"

scripts/gen_ref_nav.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
nav = mkdocs_gen_files.Nav()
88
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>'
99

10-
src = Path(__file__).parent.parent / "src"
10+
root = Path(__file__).parent.parent
11+
src = root / "src"
1112

1213
for path in sorted(src.rglob("*.py")):
1314
module_path = path.relative_to(src).with_suffix("")
@@ -30,7 +31,7 @@
3031
ident = ".".join(parts)
3132
fd.write(f"::: {ident}")
3233

33-
mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path)
34+
mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
3435

3536
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
3637
nav_file.writelines(nav.build_literate_nav())

scripts/insiders.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ def funding_goals(source: str | list[str | tuple[str, str, str]], funding: int =
155155
return _load_goals_from_disk(source, funding)
156156
goals = {}
157157
for src in source:
158-
source_goals = _load_goals(src)
158+
source_goals = _load_goals(src, funding)
159159
for amount, goal in source_goals.items():
160160
if amount not in goals:
161161
goals[amount] = goal

scripts/setup.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ if ! pdm self list 2>/dev/null | grep -q pdm-multirun; then
1212
fi
1313

1414
if [ -n "${PDM_MULTIRUN_VERSIONS}" ]; then
15+
if [ "${PDM_MULTIRUN_USE_VENVS}" -eq "1" ]; then
16+
for version in ${PDM_MULTIRUN_VERSIONS}; do
17+
if ! pdm venv --path "${version}" &>/dev/null; then
18+
pdm venv create --name "${version}" "${version}"
19+
fi
20+
done
21+
fi
1522
pdm multirun -v pdm install -G:all
1623
else
1724
pdm install -G:all

0 commit comments

Comments
 (0)