Skip to content

feat: ✨ add post-copy commands to run #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,10 @@ jobs:
- name: Install justfile and zsh
run: sudo apt install -y just zsh

- name: Set Git user
run: |
git config --global user.name "GitHub Actions"
git config --global user.email "fake@example.com"

- name: Test and check template creation
run: just test
32 changes: 26 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,43 @@ on what is included in this template.

## Using this template

We strongly recommend using this template with
[uv](https://docs.astral.sh/uv/). Once you have it installed, move into
the directory where you want to create the new Data Package and run the
following command:
You need these programs installed in order to use this template.

- [Git](https://git-scm.com/)
- [Python](https://www.python.org/)
- [uv](https://docs.astral.sh/uv/)
- [just](https://just.systems/man/en/)

Once you have these installed, open a terminal and move into the directory
where you want to create the new Data Package and run the following command:

``` bash
# Copy into the current directory with "."
uvx copier copy gh:seedcase-project/template-data-package .
uvx copier copy --trust gh:seedcase-project/template-data-package .
```

> [!CAUTION]
> This template runs some post-copy commands using your terminal. In order
> to run them, you need to use the `--trust` option. Review the
> [`copier.yml`](copier.yaml) file, under the `_tasks` key to see what
> commands will be run after copying the template, so you can know and trust
> what the commands are doing. Unfortunately, this template can't be used
> without the `--trust` option.

### Post-creation setup

These steps are mainly for us in the Seedcase Project to set up the
repository with the settings we use, but you can follow them if you want
to set up your Data Package in a similar way.

Install [`spaid`](https://github.com/seedcase-project/spaid) and use the
After copying the template, while in the directory of the new Data Package,
run the following:

``` bash
just install-precommit
```

Next, install [`spaid`](https://github.com/seedcase-project/spaid) and use the
following commands to run the next setup steps:

``` bash
Expand Down
14 changes: 14 additions & 0 deletions copier.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
_subdirectory: template

# Post-copy commands:
_tasks:
# Only run these commands when copying the template
- command: "git init -b main"
when: "{{ _copier_operation == 'copy' }}"
- command: "uv add --dev pre-commit commitizen ruff typos"
when: "{{ _copier_operation == 'copy' }}"
- command: "uv add polars seedcase-sprout"
when: "{{ _copier_operation == 'copy' }}"
- command: "git add ."
when: "{{ _copier_operation == 'copy' }}"
- command: "git commit -m 'chore: :tada: setup a new data package from the template'"
when: "{{ _copier_operation == 'copy' }}"

# Questions:
package_github_repo:
type: str
Expand Down
1 change: 1 addition & 0 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ test:
# `.` means the current directory contains the template.
uvx copier copy --vcs-ref=HEAD . $test_dir/$test_name \
--defaults \
--trust \
--data package_abbrev=$test_name \
--data package_github_repo="first-last/${test_name}" \
--data author_given_name="First" \
Expand Down
Loading