Skip to content

Commit 79581c6

Browse files
committed
feat: show current PyPI version on project cards
Fetch each project's latest version from the PyPI JSON API at build time and display it bottom-right on the home page cards. Add a weekly scheduled rebuild so versions stay current between pushes. Assisted-by: ClaudeCode:claude-opus-4.8
1 parent 6d13a83 commit 79581c6

3 files changed

Lines changed: 20 additions & 0 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Deploy to GitHub Pages
33
on:
44
push:
55
branches: [main]
6+
schedule:
7+
# Weekly rebuild to refresh PyPI versions on the home page (Mondays 06:00 UTC)
8+
- cron: "0 6 * * 1"
69
workflow_dispatch:
710

811
permissions:

assets/css/extended/homepage.css

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@
268268
color: var(--secondary);
269269
}
270270

271+
.project-card-version {
272+
margin-left: auto;
273+
align-self: flex-end;
274+
font-size: 0.75rem;
275+
font-weight: 600;
276+
font-variant-numeric: tabular-nums;
277+
color: var(--secondary);
278+
opacity: 0.8;
279+
}
280+
271281
/* Dark mode tweaks */
272282
.dark .project-card:hover {
273283
box-shadow: 0 2px 12px rgba(255, 255, 255, 0.05);

layouts/index.html

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,13 @@ <h3 class="project-card-name">{{ .name }}</h3>
148148
</svg>
149149
GitHub
150150
</span>
151+
{{- if .pypi }} {{- $pkg := path.Base (strings.TrimSuffix "/" .pypi) }}
152+
{{- $resp := try (resources.GetRemote (printf
153+
"https://pypi.org/pypi/%s/json" $pkg)) }} {{- with $resp.Value }} {{- if
154+
eq .MediaType.SubType "json" }} {{- with (transform.Unmarshal
155+
.).info.version }}
156+
<span class="project-card-version">v{{ . }}</span>
157+
{{- end }} {{- end }} {{- end }} {{- end }}
151158
</div>
152159
</a>
153160
{{- end }}

0 commit comments

Comments
 (0)