Skip to content

Commit 0433587

Browse files
committed
chore: Template upgrade
1 parent 02619a8 commit 0433587

File tree

13 files changed

+123
-89
lines changed

13 files changed

+123
-89
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: 0.15.11
2+
_commit: 0.15.23
33
_src_path: gh:pawamoy/copier-pdm
44
author_email: pawamoy@pm.me
55
author_fullname: Timothée Mazzucotelli

.github/workflows/ci.yml

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
push:
55
pull_request:
66
branches:
7-
- master
7+
- main
88

99
defaults:
1010
run:
@@ -25,6 +25,9 @@ jobs:
2525
- name: Checkout
2626
uses: actions/checkout@v3
2727

28+
- name: Fetch all tags
29+
run: git fetch --depth=1 --tags
30+
2831
- name: Set up PDM
2932
uses: pdm-project/setup-pdm@v3
3033
with:
@@ -62,10 +65,10 @@ jobs:
6265
echo 'jobs=[
6366
{"os": "macos-latest"},
6467
{"os": "windows-latest"},
65-
{"python-version": "3.8"},
6668
{"python-version": "3.9"},
6769
{"python-version": "3.10"},
68-
{"python-version": "3.11"}
70+
{"python-version": "3.11"},
71+
{"python-version": "3.12"}
6972
]' | tr -d '[:space:]' >> $GITHUB_OUTPUT
7073
else
7174
echo 'jobs=[]' >> $GITHUB_OUTPUT
@@ -82,14 +85,14 @@ jobs:
8285
- macos-latest
8386
- windows-latest
8487
python-version:
85-
- "3.7"
8688
- "3.8"
8789
- "3.9"
8890
- "3.10"
8991
- "3.11"
92+
- "3.12"
9093
exclude: ${{ fromJSON(needs.exclude-test-jobs.outputs.jobs) }}
91-
9294
runs-on: ${{ matrix.os }}
95+
continue-on-error: ${{ matrix.python-version == '3.12' }}
9396

9497
steps:
9598
- name: Checkout
@@ -99,6 +102,7 @@ jobs:
99102
uses: pdm-project/setup-pdm@v3
100103
with:
101104
python-version: ${{ matrix.python-version }}
105+
allow-python-prereleases: true
102106

103107
- name: Resolving dependencies
104108
run: pdm lock -v --no-cross-platform -G ci-tests

.gitpod.dockerfile

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
FROM gitpod/workspace-full
22
USER gitpod
33
ENV PIP_USER=no
4-
ENV PYTHON_VERSIONS=
54
RUN pip3 install pipx; \
65
pipx install pdm; \
76
pipx ensurepath

CONTRIBUTING.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,20 +39,19 @@ Run `make help` to see all the available actions!
3939
This project uses [duty](https://github.com/pawamoy/duty) to run tasks.
4040
A Makefile is also provided. The Makefile will try to run certain tasks
4141
on multiple Python versions. If for some reason you don't want to run the task
42-
on multiple Python versions, you can do one of the following:
43-
44-
1. `export PYTHON_VERSIONS= `: this will run the task
45-
with only the current Python version
46-
2. run the task directly with `pdm run duty TASK`
42+
on multiple Python versions, you run the task directly with `pdm run duty TASK`.
4743
4844
The Makefile detects if a virtual environment is activated,
4945
so `make` will work the same with the virtualenv activated or not.
5046
47+
If you work in VSCode,
48+
[see examples of tasks and run configurations](https://pawamoy.github.io/copier-pdm/work/#vscode-setup).
49+
5150
## Development
5251
5352
As usual:
5453
55-
1. create a new branch: `git checkout -b feature-or-bugfix-name`
54+
1. create a new branch: `git switch -c feature-or-bugfix-name`
5655
1. edit the code and/or the documentation
5756
5857
**Before committing:**
@@ -138,7 +137,7 @@ git commit --fixup=SHA
138137
Once all the changes are approved, you can squash your commits:
139138

140139
```bash
141-
git rebase -i --autosquash master
140+
git rebase -i --autosquash main
142141
```
143142

144143
And force-push:

Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
.DEFAULT_GOAL := help
22
SHELL := bash
33
DUTY := $(if $(VIRTUAL_ENV),,pdm run) duty
4+
export PDM_MULTIRUN_VERSIONS ?= 3.8 3.9 3.10 3.11
45

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

docs/css/insiders.css

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,25 @@ a.insiders {
101101
text-align: center;
102102
}
103103

104-
.premium-sponsors .silver img {
104+
#silver-sponsors img {
105105
height: 140px;
106106
}
107107

108-
.premium-sponsors .bronze img {
108+
#bronze-sponsors img {
109109
height: 140px;
110110
}
111111

112-
.premium-sponsors .bronze p {
112+
#bronze-sponsors p {
113113
display: flex;
114114
flex-wrap: wrap;
115115
justify-content: center;
116116
}
117117

118-
.premium-sponsors .bronze a {
118+
#bronze-sponsors a {
119119
display: block;
120120
flex-shrink: 0;
121+
}
122+
123+
.sponsors-total {
124+
font-weight: bold;
121125
}

docs/insiders/goals.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
goals: {}
1+
goals: {}

docs/insiders/index.md

Lines changed: 11 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ data_source = "docs/insiders/goals.yml"
6565

6666
<!-- ```python exec="1" session="insiders"
6767
print(f"""The moment you <a href="#how-to-become-a-sponsor">become a sponsor</a>, you'll get **immediate
68-
access to {len(completed_features)} additional features** that you can start using right away, and
68+
access to {len(unreleased_features)} additional features** that you can start using right away, and
6969
which are currently exclusively available to sponsors:\n""")
7070
71-
for feature in completed_features:
71+
for feature in unreleased_features:
7272
feature.render(badge=True)
7373
``` -->
7474

@@ -115,34 +115,17 @@ You can cancel your sponsorship anytime.[^5]
115115
regarding your payment, and GitHub doesn't offer refunds, sponsorships are
116116
non-refundable.
117117

118-
```python exec="1" session="insiders"
119-
print_join_sponsors_button()
120-
```
118+
[:octicons-heart-fill-24:{ .pulse } &nbsp; Join our <span id="sponsors-count"></span> awesome sponsors](https://github.com/sponsors/pawamoy){ .md-button .md-button--primary }
121119

122120
<hr>
123121
<div class="premium-sponsors">
124122

125-
<div class="bronze">
126-
<b>Bronze sponsors</b>
127-
<p>
128-
129-
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" title="Material for MkDocs">
130-
<img alt="Material for MkDocs" src="https://raw.githubusercontent.com/squidfunk/mkdocs-material/master/.github/assets/logo.svg" style="height: 240px;">
131-
</a>
132-
<a href="https://docs.pydantic.dev/latest/" target="_blank" title="Pydantic">
133-
<img alt="Pydantic" src="https://github.com/pawamoy/website/assets/3999221/368ff871-8fae-40c4-9b66-781b66e12cbb" style="height: 100px;">
134-
</a>
135-
136-
</p>
137-
</div>
123+
<div id="bronze-sponsors"></div>
138124
</div>
139125

140126
<hr>
141-
<br>
142127

143-
```python exec="1" session="insiders"
144-
print_sponsors()
145-
```
128+
<div id="sponsors"></div>
146129

147130
<br>
148131
<br>
@@ -155,18 +138,9 @@ print_sponsors()
155138
afterwards.
156139
</small>
157140

158-
## Funding
159-
160-
```python exec="1" session="insiders"
161-
print(f"""
162-
Current funding is at **$ {human_readable_amount(current_funding)} a month**.
163-
We do not have any funding goals yet.
164-
Stay updated by following **@pawamoy**
165-
on :material-mastodon:{{ .mastodon }} [Fosstodon](https://fosstodon.org/@pawamoy).
166-
""")
167-
```
141+
## Funding <span class="sponsors-total"></span>
168142

169-
<!-- ### Goals
143+
### Goals
170144

171145
The following section lists all funding goals. Each goal contains a list of
172146
features prefixed with a checkmark symbol, denoting whether a feature is
@@ -191,7 +165,7 @@ can be used by all users.
191165
for goal in goals.values():
192166
if goal.complete:
193167
goal.render()
194-
``` -->
168+
```
195169

196170
## Frequently asked questions
197171

@@ -248,3 +222,6 @@ by the [ISC License][license]. However, we kindly ask you to respect our
248222
[billing cycle]: https://docs.github.com/en/github/setting-up-and-managing-billing-and-payments-on-github/changing-the-duration-of-your-billing-cycle
249223
[license]: ../license/
250224
[private forks]: https://docs.github.com/en/github/setting-up-and-managing-your-github-user-account/removing-a-collaborator-from-a-personal-repository
225+
226+
<script src="../js/insiders.js"></script>
227+
<script>updateInsidersPage('pawamoy');</script>

docs/js/insiders.js

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
function humanReadableAmount(amount) {
2+
const strAmount = String(amount);
3+
if (strAmount.length >= 4) {
4+
return `${strAmount.slice(0, strAmount.length - 3)},${strAmount.slice(-3)}`;
5+
}
6+
return strAmount;
7+
}
8+
9+
function getJSON(url, callback) {
10+
var xhr = new XMLHttpRequest();
11+
xhr.open('GET', url, true);
12+
xhr.responseType = 'json';
13+
xhr.onload = function () {
14+
var status = xhr.status;
15+
if (status === 200) {
16+
callback(null, xhr.response);
17+
} else {
18+
callback(status, xhr.response);
19+
}
20+
};
21+
xhr.send();
22+
}
23+
24+
function updateInsidersPage(author_username) {
25+
const sponsorURL = `https://github.com/sponsors/${author_username}`
26+
const dataURL = `https://raw.githubusercontent.com/${author_username}/sponsors/main`;
27+
getJSON(dataURL + '/numbers.json', function (err, numbers) {
28+
document.getElementById('sponsors-count').innerHTML = numbers.count;
29+
Array.from(document.getElementsByClassName('sponsors-total')).forEach(function (element) {
30+
element.innerHTML = '$ ' + humanReadableAmount(numbers.total);
31+
});
32+
getJSON(dataURL + '/sponsors.json', function (err, sponsors) {
33+
const sponsorsElem = document.getElementById('sponsors');
34+
const privateSponsors = numbers.count - sponsors.length;
35+
sponsors.forEach(function (sponsor) {
36+
sponsorsElem.innerHTML += `
37+
<a href="${sponsor.url}" class="sponsorship-item" title="@${sponsor.name}">
38+
<img src="${sponsor.image}&size=72">
39+
</a>
40+
`;
41+
});
42+
if (privateSponsors > 0) {
43+
sponsorsElem.innerHTML += `
44+
<a href="${sponsorURL}" class="sponsorship-item private">
45+
+${privateSponsors}
46+
</a>
47+
`;
48+
}
49+
});
50+
});
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+
});
67+
}

duties.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,6 @@ def test(ctx: Context, match: str = "") -> None:
299299
py_version = f"{sys.version_info.major}{sys.version_info.minor}"
300300
os.environ["COVERAGE_FILE"] = f".coverage.{py_version}"
301301
ctx.run(
302-
pytest.run("-n", "auto", "tests", config_file="config/pytest.ini", select=match),
302+
pytest.run("-n", "auto", "tests", config_file="config/pytest.ini", select=match, color="yes"),
303303
title=pyprefix("Running tests"),
304304
)

0 commit comments

Comments
 (0)