Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dd79ccd
Rename template folder and files in preparation of migration to copier
lyashevska Jul 30, 2024
616ee56
Migrate from cookiecutter to copier
lyashevska Jul 30, 2024
d8ad6a8
Update template/README.md.jinja to copier
lyashevska Jul 30, 2024
39d374c
Update README.md to use copier
lyashevska Jul 30, 2024
7c89fe9
Handle directory_name
lyashevska Aug 1, 2024
ce6dd06
fix tests
egpbos Aug 1, 2024
e1163da
Escape quotes in name and description
lyashevska Aug 1, 2024
7d573c5
Merge pull request #414 from NLeSC/407-add-validators
lyashevska Aug 15, 2024
95c293d
Update readme dev
lyashevska Aug 15, 2024
755e961
Update README.dev.md
lyashevska Aug 15, 2024
d7d5dfb
Update README.dev.md
lyashevska Aug 15, 2024
3ae01a3
Merge pull request #418 from NLeSC/update-copier-readme.dev.md
lyashevska Aug 15, 2024
c7db00f
switch PR template instructions to copier
sjvrijn Aug 19, 2024
41177d8
restore mktemp instruction; add explanatory comments
sjvrijn Aug 19, 2024
98074b7
Update .github/PULL_REQUEST_TEMPLATE.md
sjvrijn Aug 19, 2024
b07cc6d
Merge pull request #437 from NLeSC/417-update-gh-pr-template
sjvrijn Aug 19, 2024
1401b8e
replace cookiecutter with copier in final files
sjvrijn Aug 19, 2024
6328722
Merge pull request #442 from NLeSC/remove-final-cookie-mentions
sjvrijn Aug 19, 2024
89168be
add messages when creating and copying files
Aug 19, 2024
a4218b5
add messages when creating and copying files
Aug 19, 2024
f31c6eb
remove double quotes
fdiblen Aug 19, 2024
03bb887
update the patch in before copy message
fdiblen Aug 19, 2024
d711d6a
update the patch in before copy message
fdiblen Aug 19, 2024
af6f53b
Merge pull request #443 from NLeSC/409_additional_messages
fdiblen Aug 19, 2024
344ca0f
fix typo
sjvrijn Aug 19, 2024
b805491
remove ADD_TO_EXISTING_PACKAGE file
sjvrijn Aug 19, 2024
79cea70
update usage instruction to explain 3 ways to use copier
sjvrijn Aug 19, 2024
6e09142
Update README.md
sjvrijn Aug 20, 2024
5f369e7
Update README.md
sjvrijn Aug 20, 2024
fc07bfe
Update README.md
sjvrijn Aug 20, 2024
5aa33de
Update README.md
sjvrijn Aug 20, 2024
227f82b
rename options/cases to scenarios
sjvrijn Aug 20, 2024
83c590d
Fix merge conflicts
lyashevska Aug 20, 2024
4debab7
Add pipx install instructions + explanation
sjvrijn Aug 20, 2024
399a7a1
scenarios as list
sjvrijn Aug 20, 2024
7548239
Merge pull request #444 from NLeSC/416-instructions-update-existing
sjvrijn Aug 20, 2024
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
File renamed without changes.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/10_generated_package.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ assignees: ''

---
<!--
Whatever you write here must have something to do with the code you get from running `cookiecutter`.
Whatever you write here must have something to do with the code you get from running `copier`.
-->
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/20_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ assignees: ''

---
<!--
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `cookiecutter`.
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `copier`.
-->
9 changes: 6 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,18 @@
<!-- remove what doesn't apply or add more if needed -->
Create a `python-template-test` repo on GitHub (will be overwritten if existing)
```
# Create a temporary directory by running the following command. Keep the XXXXXX in the directory name.
cd $(mktemp -d --tmpdir py-tmpl-XXXXXX)
cookiecutter -c <pr-branch> https://github.com/<pr-user>/python-template
# Use --vcs-ref <pr-branch> to point to the branch you want to test
copier copy --vcs-ref <pr-branch> https://github.com/<pr-user>/python-template .
# Fill with python-template-test info
cd python-template-test
# Create a local git repo to push to GitHub to trigger CI actions
git init
git add --all
git commit -m "First commit"
git remote add origin https://github.com/<you>/python-template-test
git remote add origin git@github.com:<you>/python-template-test.git
git push -u origin main -f
# Create a local environment to test your generated package locally
python -m venv env
source env/bin/activate
python -m pip install --upgrade pip setuptools
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ env
env3
venv
venv3

.swp
29 changes: 0 additions & 29 deletions ADD_TO_EXISTING_PACKAGE.md

This file was deleted.

2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ cff-version: "1.2.0"
date-released: 2018-07-17
doi: 10.5281/zenodo.1310751
keywords:
- cookiecutter
- copier
- template
- Python
license: Apache-2.0
Expand Down
2 changes: 1 addition & 1 deletion NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NLeSC Cookiecutter template for Python
NLeSC Copier template for Python
Copyright 2021, Netherlands eScience Center
30 changes: 20 additions & 10 deletions README.dev.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,17 @@ If you're looking for user documentation, go [here](README.md).

## Development install

### Install `cookiecutter` in user space
### Install `copier` in user space

We recommend installing `cookiecutter` in user space as per `cookiecutter`'s instructions. This way, you don't have to
install `cookiecutter` for every new project.
We recommend installing `copier` in user space. This way, you don't have to
install `copier` for every new project.

```shell
python -m pip install --user --upgrade cookiecutter
python -m pip install --user --upgrade copier
```



### Get your own copy of the repository

Before you can do development work on the template, you'll need to check out a local copy of the repository:
Expand All @@ -23,6 +25,13 @@ git clone https://github.com/NLeSC/python-template.git
cd python-template
```

Please note that if you are working from some other branch than `main`, you should switch to that branch. For example, if you are working from the `dev` branch, you should do:

```shell
git fetch origin
git switch -c dev origin/dev
```

### Create a virtual environment

Next, make a virtual environment, activate it, and install the development dependencies in it. This will enable you to
Expand Down Expand Up @@ -53,27 +62,28 @@ pytest
pytest tests/
```

## Using `cookiecutter` to generate a new package from the command line
## Using `copier` to generate a new package from the command line

While making changes to the template, you'll regularly want to verify that the packages generated with the template
still work. Any easy way to do this is to generate new packages in a temporary directory (which will get removed
everytime you reboot), for example like so:

```shell
# change directory to a new temporary directory
cd $(mktemp -d --tmpdir cookiecutter-generated.XXXXXX)
cd $(mktemp -d --tmpdir copier-generated.XXXXXX)

# run cookiecutter with the template to generate a new package
cookiecutter <path to where your template is>
# run copier with the template to generate a new package
copier copy --vcs-ref HEAD <path/to/project/template> my-python-project

# when it asks you for the GitHub organization, put in your own name;
# for the other questions, just accept the default

# 'ls' should return just the one directory called 'my-python-project'
ls
```
Notice, that the `--vcs-ref HEAD` flag is used to make sure that the current checked out version of the local template is used.

If your Python package was created successfully, `cookiecutter` will point you to a file
If your Python package was created successfully, `copier` will point you to a file
(`my-python-project/next_steps.md`) that contains information on next steps.

In addition to the information in `my-python-project/project_setup.md`, the developer documentation
Expand All @@ -95,7 +105,7 @@ Follow the instructions from `my-python-project/README.dev.md` and make sure tha
2. Verify that the information in `CITATION.cff` is correct.
3. Make sure that `version` in [setup.cfg](setup.cfg) and `version` in [CITATION.cff](CITATION.cff) have been bumped to the to-be-released version of the template
4. Run the unit tests with `pytest tests/`
5. Go through the steps outlined above for [generating a new package from the command line](#using-cookiecutter-to-generate-a-new-package-from-the-command-line), and verify that the generated package works as it should.
5. Go through the steps outlined above for [generating a new package from the command line](#using-copier-to-generate-a-new-package-from-the-command-line), and verify that the generated package works as it should.

### GitHub

Expand Down
Loading