Skip to content

Commit e3f9cc8

Browse files
committed
build: 🔧 match template-website justfile
1 parent 7ac1a31 commit e3f9cc8

File tree

4 files changed

+86
-4
lines changed

4 files changed

+86
-4
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
1+
2+
13
# Template for Seedcase Python packages
24

3-
This repository contains a template for setting up new Python package projects in Seedcase. The first step is to create a new repository using this template. This can easily be done by clicking the "Use this template" button on the repository page or by using the GitHub CLI:
5+
This repository contains a template for setting up new Python package
6+
projects in Seedcase. The first step is to create a new repository using
7+
this template. This can easily be done by clicking the “Use this
8+
template” button on the repository page or by using the GitHub CLI:
49

510
``` bash
611
# NAME is the name to give the new repository
@@ -9,11 +14,14 @@ gh repo create NAME --template seedcase-project/template-python-project
914

1015
## Setting things up after cloning
1116

12-
Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items.
17+
Search for `NAME` and `REPO` and replace them with the name of your
18+
project and the repository name. Then look for any `TODO` items.
1319

1420
## Setting things up
1521

16-
Use the commands found in [`spaid`](https://github.com/seedcase-project/spaid) repo to run the next setup steps.
22+
Use the commands found in
23+
[`spaid`](https://github.com/seedcase-project/spaid) repo to run the
24+
next setup steps.
1725

1826
Need to install these packages after:
1927

README.qmd

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Template for Seedcase Python packages
2+
3+
This repository contains a template for setting up new Python package projects in Seedcase. The first step is to create a new repository using this template. This can easily be done by clicking the "Use this template" button on the repository page or by using the GitHub CLI:
4+
5+
``` bash
6+
# NAME is the name to give the new repository
7+
gh repo create NAME --template seedcase-project/template-python-project
8+
```
9+
10+
## Setting things up after cloning
11+
12+
Search for `NAME` and `REPO` and replace them with the name of your project and the repository name. Then look for any `TODO` items.
13+
14+
## Setting things up
15+
16+
Use the commands found in [`spaid`](https://github.com/seedcase-project/spaid) repo to run the next setup steps.
17+
18+
Need to install these packages after:
19+
20+
``` bash
21+
uv add --dev pre-commit ruff typos pytest bandit commitizen \
22+
genbadge jupyter pytest-cov quartodoc
23+
```

justfile

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
@_default:
22
just --list --unsorted
33

4+
@_checks: check-spelling check-commits
5+
@_builds: build-contributors build-website build-readme
6+
47
# Run all build-related recipes in the justfile
5-
run-all: check-spelling check-commits build-website
8+
run-all: update-quarto-theme update-template _checks test _builds
69

710
# Install the pre-commit hooks
811
install-precommit:
@@ -13,6 +16,18 @@ install-precommit:
1316
# Update versions of pre-commit hooks
1417
uvx pre-commit autoupdate
1518

19+
# Update the Quarto seedcase-theme extension
20+
update-quarto-theme:
21+
quarto add seedcase-project/seedcase-theme --no-prompt
22+
23+
# Update files in the template from the copier parent folder
24+
update-template:
25+
cp .cz.toml .pre-commit-config.yaml .typos.toml .editorconfig template/
26+
mkdir -p template/tools
27+
cp tools/get-contributors.sh template/tools/
28+
cp .github/pull_request_template.md template/.github/
29+
cp .github/workflows/build-website.yml .github/workflows/dependency-review.yml template/.github/workflows/
30+
1631
# Check the commit messages on the current branch that are not on the main branch
1732
check-commits:
1833
#!/bin/zsh
@@ -29,6 +44,24 @@ check-commits:
2944
check-spelling:
3045
uvx typos
3146

47+
# Test and check that a Python package can be created from the template
48+
# TODO: add test for copier
49+
test:
50+
echo "copier test"
51+
52+
# Clean up any leftover and temporary build files
53+
cleanup:
54+
#!/bin/zsh
55+
rm -rf _temp
56+
3257
# Build the website using Quarto
3358
build-website:
3459
uvx --from quarto quarto render
60+
61+
# Re-build the README file from the Quarto version
62+
build-readme:
63+
uvx --from quarto quarto render README.qmd --to gfm
64+
65+
# Generate a Quarto include file with the contributors
66+
build-contributors:
67+
sh ./tools/get-contributors.sh seedcase-project/template-workshop

tools/get-contributors.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env bash
2+
3+
# Get a list of contributors to this repository and save it to
4+
# _contributors.qmd.tmp file. It also:
5+
#
6+
# - Formats users into Markdown links to their GitHub profiles.
7+
# - Removes any usernames with the word "bot" in them.
8+
# - Removes the trailing comma from the list.
9+
repo_spec=${1}
10+
echo "These are the people who have contributed by submitting changes through pull requests :tada:\n\n" > _contributors.qmd.tmp
11+
gh api \
12+
-H "Accept: application/vnd.github+json" \
13+
-H "X-GitHub-Api-Version: 2022-11-28" \
14+
/repos/$repo_spec/contributors \
15+
--template '{{range .}} [\@{{.login}}]({{.html_url}}){{"\n"}}{{end}}' | \
16+
grep -v "\[bot\]" | \
17+
tr '\n' ', ' | \
18+
sed -e 's/,$//' >> _contributors.qmd.tmp

0 commit comments

Comments
 (0)