chore: Template upgrade

This commit is contained in:
Timothée Mazzucotelli
2024-03-20 16:29:27 +01:00
parent adff40b292
commit b9f0e954be
15 changed files with 85 additions and 52 deletions
+4 -3
View File
@@ -1,14 +1,15 @@
# Changes here will be overwritten by Copier
_commit: 1.1.3
_commit: 1.2.6
_src_path: gh:pawamoy/copier-pdm
author_email: pawamoy@pm.me
author_email: dev@pawamoy.fr
author_fullname: Timothée Mazzucotelli
author_username: pawamoy
copyright_date: '2022'
copyright_holder: Timothée Mazzucotelli
copyright_holder_email: pawamoy@pm.me
copyright_holder_email: dev@pawamoy.fr
copyright_license: ISC License
insiders: true
insiders_email: insiders@pawamoy.fr
insiders_repository_name: markdown-exec
project_description: Utilities to execute code blocks in Markdown files.
project_name: Markdown Exec
+4 -4
View File
@@ -23,7 +23,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --depth=1 --tags
@@ -32,7 +32,7 @@ jobs:
uses: ts-graphviz/setup-graphviz@v1
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: "3.8"
@@ -99,10 +99,10 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Set up PDM
uses: pdm-project/setup-pdm@v3
uses: pdm-project/setup-pdm@v4
with:
python-version: ${{ matrix.python-version }}
allow-python-prereleases: true
+2 -2
View File
@@ -10,7 +10,7 @@ jobs:
if: startsWith(github.ref, 'refs/tags/')
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Fetch all tags
run: git fetch --depth=1 --tags
- name: Setup Python
@@ -22,7 +22,7 @@ jobs:
if: github.repository_owner == 'pawamoy-insiders'
run: python -m build
- name: Upload dists artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: github.repository_owner == 'pawamoy-insiders'
with:
name: markdown-exec-insiders
+1
View File
@@ -1,4 +1,5 @@
.idea/
.vscode/
__pycache__/
*.py[cod]
dist/
+1 -1
View File
@@ -60,7 +60,7 @@ representative at an online or offline event.
Instances of abusive, harassing, or otherwise unacceptable behavior may be
reported to the community leaders responsible for enforcement at
pawamoy@pm.me.
dev@pawamoy.fr.
All complaints will be reviewed and investigated promptly and fairly.
All community leaders are obligated to respect the privacy and security of the
+1
View File
@@ -2,6 +2,7 @@
SHELL := bash
DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11 3.12
export PDM_MULTIRUN_USE_VENVS ?= $(if $(shell pdm config python.use_venv | grep True),1,0)
args = $(foreach a,$($(subst -,_,$1)_args),$(if $(value $a),$a="$($a)"))
check_quality_args = files
+5 -1
View File
@@ -1,5 +1,5 @@
target-version = "py38"
line-length = 132
line-length = 120
exclude = [
"fixtures",
"site",
@@ -102,3 +102,7 @@ known-first-party = ["markdown_exec"]
[pydocstyle]
convention = "google"
[format]
docstring-code-format = true
docstring-code-line-length = 80
+2 -2
View File
@@ -3,7 +3,7 @@
"configurations": [
{
"name": "python (current file)",
"type": "python",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
@@ -11,7 +11,7 @@
},
{
"name": "test",
"type": "python",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"justMyCode": false,
+28 -17
View File
@@ -60,17 +60,31 @@ data_source = "docs/insiders/goals.yml"
```
<!-- blacken-docs:off -->
```python exec="1" session="insiders"
```python exec="1" session="insiders" idprefix=""
--8<-- "scripts/insiders.py"
print(
f"""The moment you <a href="#how-to-become-a-sponsor">become a sponsor</a>, you'll get **immediate
access to {len(unreleased_features)} additional features** that you can start using right away, and
which are currently exclusively available to sponsors:\n"""
)
if unreleased_features:
print(
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get **immediate "
f"access to {len(unreleased_features)} additional features** that you can start using right away, and "
"which are currently exclusively available to sponsors:\n"
)
for feature in unreleased_features:
feature.render(badge=True)
for feature in unreleased_features:
feature.render(badge=True)
print(
"\n\nThese are just the features related to this project. "
"[See the complete feature list on the author's main Insiders page](https://pawamoy.github.io/insiders/#whats-in-it-for-me)."
)
else:
print(
"The moment you [become a sponsor](#how-to-become-a-sponsor), you'll get immediate "
"access to all released features that you can start using right away, and "
"which are exclusively available to sponsors. At this moment, there are no "
"Insiders features for this project, but checkout the [next funding goals](#goals) "
"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).**"
)
```
<!-- blacken-docs:on -->
@@ -83,7 +97,7 @@ You can use your individual or organization GitHub account for sponsoring.
**Important**: If you're sponsoring **[@pawamoy][github sponsor profile]**
through a GitHub organization, please send a short email
to pawamoy@pm.me with the name of your
to insiders@pawamoy.fr with the name of your
organization and the GitHub account of the individual
that should be added as a collaborator.[^4]
@@ -92,7 +106,7 @@ You can cancel your sponsorship anytime.[^5]
[^4]:
It's currently not possible to grant access to each member of an
organization, as GitHub only allows for adding users. Thus, after
sponsoring, please send an email to pawamoy@pm.me, stating which
sponsoring, please send an email to insiders@pawamoy.fr, stating which
account should become a collaborator of the Insiders repository. We're
working on a solution which will make access to organizations much simpler.
To ensure that access is not tied to a particular individual GitHub account,
@@ -116,11 +130,10 @@ You can cancel your sponsorship anytime.[^5]
<hr>
<div class="premium-sponsors">
<div id="bronze-sponsors"></div>
<div id="gold-sponsors"></div>
<div id="silver-sponsors"></div>
<div id="bronze-sponsors"></div>
</div>
<hr>
<div id="sponsors"></div>
@@ -176,8 +189,6 @@ feature flags. Most Insiders features enhance the overall experience,
though while these features add value for the users of your project, they
shouldn't be necessary for previewing when making changes to content.
### Payment
> 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
could also create a dedicated GitHub account with a yearly billing cycle, which
you only use for sponsoring (some sponsors already do that).
If you have any problems or further questions, please reach out to pawamoy@pm.me.
If you have any problems or further questions, please reach out to insiders@pawamoy.fr.
### Terms
+23 -16
View File
@@ -21,6 +21,26 @@ function getJSON(url, callback) {
xhr.send();
}
function updatePremiumSponsors(dataURL, rank) {
let capRank = rank.charAt(0).toUpperCase() + rank.slice(1);
getJSON(dataURL + `/sponsors${capRank}.json`, function (err, sponsors) {
const sponsorsDiv = document.getElementById(`${rank}-sponsors`);
if (sponsors.length > 0) {
let html = '';
html += `<b>${capRank} sponsors</b><p>`
sponsors.forEach(function (sponsor) {
html += `
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
</a>
`
});
html += '</p>'
sponsorsDiv.innerHTML = html;
}
});
}
function updateInsidersPage(author_username) {
const sponsorURL = `https://github.com/sponsors/${author_username}`
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
@@ -48,20 +68,7 @@ function updateInsidersPage(author_username) {
}
});
});
getJSON(dataURL + '/sponsorsBronze.json', function (err, sponsors) {
const bronzeSponsors = document.getElementById("bronze-sponsors");
if (sponsors) {
let html = '';
html += '<b>Bronze sponsors</b><p>'
sponsors.forEach(function (sponsor) {
html += `
<a href="${sponsor.url}" target="_blank" title="${sponsor.name}">
<img alt="${sponsor.name}" src="${sponsor.image}" style="height: ${sponsor.imageHeight}px;">
</a>
`
});
html += '</p>'
bronzeSponsors.innerHTML = html;
}
});
updatePremiumSponsors(dataURL, "gold");
updatePremiumSponsors(dataURL, "silver");
updatePremiumSponsors(dataURL, "bronze");
}
+2 -2
View File
@@ -10,7 +10,7 @@ from pathlib import Path
from typing import TYPE_CHECKING, Iterator
from duty import duty
from duty.callables import black, coverage, lazy, mkdocs, mypy, pytest, ruff, safety
from duty.callables import coverage, lazy, mkdocs, mypy, pytest, ruff, safety
if TYPE_CHECKING:
from duty.context import Context
@@ -227,7 +227,7 @@ def format(ctx: Context) -> None:
ruff.check(*PY_SRC_LIST, config="config/ruff.toml", fix_only=True, exit_zero=True),
title="Auto-fixing code",
)
ctx.run(black.run(*PY_SRC_LIST, config="config/black.toml"), title="Formatting code")
ctx.run(ruff.format(*PY_SRC_LIST, config="config/ruff.toml"), title="Formatting code")
@duty(post=["docs-deploy"])
+1 -1
View File
@@ -5,7 +5,7 @@ build-backend = "pdm.backend"
[project]
name = "markdown-exec"
description = "Utilities to execute code blocks in Markdown files."
authors = [{name = "Timothée Mazzucotelli", email = "pawamoy@pm.me"}]
authors = [{name = "Timothée Mazzucotelli", email = "dev@pawamoy.fr"}]
license = {text = "ISC"}
readme = "README.md"
requires-python = ">=3.8"
+3 -2
View File
@@ -7,7 +7,8 @@ import mkdocs_gen_files
nav = mkdocs_gen_files.Nav()
mod_symbol = '<code class="doc-symbol doc-symbol-nav doc-symbol-module"></code>'
src = Path(__file__).parent.parent / "src"
root = Path(__file__).parent.parent
src = root / "src"
for path in sorted(src.rglob("*.py")):
module_path = path.relative_to(src).with_suffix("")
@@ -30,7 +31,7 @@ for path in sorted(src.rglob("*.py")):
ident = ".".join(parts)
fd.write(f"::: {ident}")
mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path)
mkdocs_gen_files.set_edit_path(full_doc_path, ".." / path.relative_to(root))
with mkdocs_gen_files.open("reference/SUMMARY.md", "w") as nav_file:
nav_file.writelines(nav.build_literate_nav())
+1 -1
View File
@@ -155,7 +155,7 @@ def funding_goals(source: str | list[str | tuple[str, str, str]], funding: int =
return _load_goals_from_disk(source, funding)
goals = {}
for src in source:
source_goals = _load_goals(src)
source_goals = _load_goals(src, funding)
for amount, goal in source_goals.items():
if amount not in goals:
goals[amount] = goal
+7
View File
@@ -12,6 +12,13 @@ if ! pdm self list 2>/dev/null | grep -q pdm-multirun; then
fi
if [ -n "${PDM_MULTIRUN_VERSIONS}" ]; then
if [ "${PDM_MULTIRUN_USE_VENVS}" -eq "1" ]; then
for version in ${PDM_MULTIRUN_VERSIONS}; do
if ! pdm venv --path "${version}" &>/dev/null; then
pdm venv create --name "${version}" "${version}"
fi
done
fi
pdm multirun -v pdm install -G:all
else
pdm install -G:all