Skip to content

Commit f71efd1

Browse files
signekblwjohnst86
andauthored
refactor: ♻️ convert to using updated template data package (#29)
# Description This PR updates the repo to use the updated `template-data-package`. It also starts the process of using the `*_properties.py` scripts in `main.py`. For this PR, I've followed the Sprout [Creating a Data Package](https://sprout.seedcase-project.org/docs/guide/packages) guide and updated the package properties and `datapackage.json` and `README.md` by uncommenting those steps in `main.py`. I'll do a separate PR that adds the data resources and updates the preprocessing scripts. Closes #23 This PR needs an in-depth review. ## Checklist - [X] Ran `just run-all` (fails bc some comment lines are too long in `scripts/download-data.py` and `scripts/convert-meta.py`, will fix in a separate PR adding the data resources) --------- Co-authored-by: Luke W. Johnston <lwjohnst86@users.noreply.github.com>
1 parent 61cb09f commit f71efd1

27 files changed

+995
-978
lines changed

.copier-answers.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Changes here will be overwritten by Copier; NEVER EDIT MANUALLY
2+
_commit: 0.15.3
3+
_src_path: gh:seedcase-project/template-data-package
4+
author_email: signekb@clin.au.dk
5+
author_family_name: Brødbæk
6+
author_given_name: Signe Kirk
7+
cc0_license: true
8+
copyright_year: '2025'
9+
github_board_number: '18'
10+
package_abbrev: example-rhesus-monkeys
11+
package_github_repo: seedcase-project/example-rhesus-monkeys
12+
review_team: '@seedcase-project/developers'

.cz.toml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
[tool.commitizen]
2-
version = "0.3.1"
3-
bump_message = "build(version): :bookmark: update version from $current_version to $new_version [skip ci]"
4-
version_schema = "semver"
5-
version_provider = "commitizen"
2+
bump_message = "build(version): :bookmark: update version from $current_version to $new_version"
63
update_changelog_on_bump = true
4+
version_provider = "uv"
5+
version_files = [
6+
"pyproject.toml:version",
7+
"scripts/package_properties.py:version",
8+
"datapackage.json:version"
9+
]
710
# Don't regenerate the changelog on every update
811
changelog_incremental = true

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: monthly
7+
commit-message:
8+
prefix: ci
9+
include: scope
10+
11+
- package-ecosystem: uv
12+
directory: /
13+
schedule:
14+
interval: monthly
15+
commit-message:
16+
prefix: build
17+
include: scope

.github/pull_request_template.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
# Description
22

3-
These changes EXPLANATION
43

54
Closes #
65

76
This PR needs a quick/an in-depth review.
87

98
## Checklist
109

11-
- [ ] Formatted Markdown
12-
- [ ] Ran `just run-all`
10+
- [ ] Format Markdown
11+
- [ ] Run `just run-all`

.github/workflows/add-to-project.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ on:
1111
- reopened
1212
- opened
1313

14-
permissions:
15-
pull-requests: write
14+
# Limit token permissions for security
15+
permissions: read-all
1616

1717
jobs:
1818
add-to-project:
1919
uses: seedcase-project/.github/.github/workflows/reusable-add-to-project.yml@main
20+
permissions:
21+
pull-requests: write
2022
with:
2123
board-number: 18
2224
app-id: ${{ vars.ADD_TO_BOARD_APP_ID }}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Release package
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
# Limit token permissions for security
9+
permissions: read-all
10+
11+
jobs:
12+
release:
13+
# This job outputs env variables `previous_version` and `current_version`.
14+
# Only give permissions for this job.
15+
permissions:
16+
contents: write
17+
uses: seedcase-project/.github/.github/workflows/reusable-release-project.yml@main
18+
with:
19+
app-id: ${{ vars.UPDATE_VERSION_APP_ID }}
20+
secrets:
21+
update-version-gh-token: ${{ secrets.UPDATE_VERSION_TOKEN }}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: Update from template
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Every day at 3:30 at night.
7+
- cron: '30 3 * * *'
8+
9+
# Limit token permissions for security
10+
permissions: read-all
11+
12+
jobs:
13+
update-from-template:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
pull-requests: write
17+
steps:
18+
- name: Harden the runner (Audit all outbound calls)
19+
uses: step-security/harden-runner@0634a2670c59f64b4a01f0f96f84700a4088b9f0 # v2.12.0
20+
with:
21+
egress-policy: audit
22+
23+
- name: Check out repository
24+
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
25+
26+
- name: Install Python
27+
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
28+
with:
29+
python-version: "3.13"
30+
31+
- name: Install dependencies
32+
run: |
33+
sudo apt install pipx
34+
pipx ensurepath
35+
pipx install uv rust-just copier
36+
37+
- name: Set User
38+
run: |
39+
git config user.name "github-actions[bot]"
40+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
41+
42+
- name: Pull request with updates from template
43+
run: |
44+
copier update --trust --defaults --overwrite
45+
any_changes=$(git status --porcelain=v1 2>/dev/null | wc -l)
46+
if [ "$any_changes" -eq 0 ]; then
47+
echo "No updates from the template detected, and no changes found. Stopping and exiting."
48+
exit 0
49+
fi
50+
git checkout -b chore/update-from-template
51+
git add .
52+
git commit -m "chore(sync): :hammer: update changes from template"
53+
gh pr create \
54+
--title "chore(sync): :hammer: update changes from template" \
55+
--body "This PR is automatically generated by the 'update-from-template' workflow. It syncs the latest changes from the template repository with this repository."

.gitignore

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
_ignore
33
bin/
44
dev/
5-
_temp/
65

76
# Temporary files
87
*.tmp
@@ -27,22 +26,28 @@ venv
2726
__pycache__/
2827
*.py[cod]
2928

29+
# Raw data files and folders
30+
*.parquet
31+
*.csv
32+
/data-raw/
33+
/raw/
34+
/data/
35+
3036
# MacOS
3137
.DS_Store
3238

3339
# Quarto
3440
/.quarto/
3541
docs/.quarto/
36-
37-
# Quartodoc
38-
objects.json
42+
*.ipynb
43+
*.quarto_ipynb
44+
*_files/
3945

4046
# Website generation
4147
_site
4248
_book
4349
public
4450
site
4551

46-
4752
# Misc files
4853
*.log

.pre-commit-config.yaml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@ ci:
66

77
repos:
88
- repo: https://github.com/gitleaks/gitleaks
9-
rev: v8.28.0
9+
rev: v8.27.2
1010
hooks:
1111
- id: gitleaks
1212

1313
- repo: https://github.com/pre-commit/pre-commit-hooks
14-
rev: v6.0.0
14+
rev: v5.0.0
1515
hooks:
1616
- id: trailing-whitespace
1717
- id: end-of-file-fixer
18+
- id: check-merge-conflict
19+
args: [--assume-in-merge]
1820

1921
- repo: https://github.com/commitizen-tools/commitizen
2022
rev: v4.8.3

.typos.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
[files]
2+
extend-exclude = [
3+
"*.json",
4+
"*.csv"
5+
]

0 commit comments

Comments
 (0)