Skip to content

Commit 616ee56

Browse files
lyashevskasjvrijn
andcommitted
Migrate from cookiecutter to copier
This migrates from cookiecutter template to copier while keeping all original features. Closes #348 Co-authored-by: Olga Lyashevska <olga.lyashevska@gmail.com> Co-authored-by: Sander van Rijn <s.vanrijn@esciencecenter.nl>
1 parent dd79ccd commit 616ee56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+622
-562
lines changed

.copier-answers.yml

Whitespace-only changes.

.github/ISSUE_TEMPLATE/10_generated_package.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ assignees: ''
77

88
---
99
<!--
10-
Whatever you write here must have something to do with the code you get from running `cookiecutter`.
10+
Whatever you write here must have something to do with the code you get from running `copier`.
1111
-->

.github/ISSUE_TEMPLATE/20_template.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ assignees: ''
77

88
---
99
<!--
10-
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `cookiecutter`.
10+
Whatever you write here must have something to do with the code of the template itself, i.e. before you run `copier`.
1111
-->

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,5 @@ env
2626
env3
2727
venv
2828
venv3
29+
30+
.swp

ADD_TO_EXISTING_PACKAGE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ The following steps requires that your existing code is in a GitHub repository.
44

55
1. Follow the [instructions to create a new package](https://github.com/NLeSC/python-template#how-to-use) with the Python template, while answering the questions like you would for the existing package.
66

7-
2. Create a Git structure for the new directory: (replace `<NEW_DIRECTORY>` with directory name you used during cookiecutter questionnaire)
7+
2. Create a Git structure for the new directory: (replace `<NEW_DIRECTORY>` with directory name you used during coopier questionnaire)
88
```shell
99
$ cd <NEW_DIRECTORY>
1010
$ git init
1111
$ git add --all
12-
$ git commit -m "Added code generated by cookiecutter"
12+
$ git commit -m "Added code generated by copier"
1313
$ git branch -M main
1414
```
1515

@@ -24,6 +24,6 @@ $ git merge existing_code/<BRANCH> --allow-unrelated-histories
2424
5. Once all conflicts have been resolved then add all the files to GitHub:
2525
```shell
2626
$ git add --all
27-
$ git commit -m "Merged existing code with code generated by cookiecutter"
27+
$ git commit -m "Merged existing code with code generated by copier"
2828
$ git push
2929
```

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ cff-version: "1.2.0"
7272
date-released: 2018-07-17
7373
doi: 10.5281/zenodo.1310751
7474
keywords:
75-
- cookiecutter
75+
- copier
7676
- template
7777
- Python
7878
license: Apache-2.0

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Use this [Cookiecutter](https://cookiecutter.readthedocs.io) template to generat
88
an empty Python package. Features include:
99

1010
- Boilerplate unit tests and documentation,
11-
- [Python static setup configuration]({{cookiecutter.directory_name}}/pyproject.toml),
11+
- [Python static setup configuration]({{directory_name}}/pyproject.toml),
1212
- Open source software license,
1313
- Continuous integration with [GitHub action workflows]({{cookiecutter.directory_name}}/.github/workflows) for building, testing, link checking and linting,
1414
- Code style checking with [ruff](https://beta.ruff.rs/),

cookiecutter.json

Lines changed: 0 additions & 14 deletions
This file was deleted.

copier.yml

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Essential questions
2+
3+
package_name:
4+
type: str
5+
default: my_python_package
6+
help: Enter the name of the Python package.
7+
validator: >-
8+
{% if not (package_name | regex_search('^[a-z][a-z0-9\_]+$')) %}
9+
package_name must start with a letter, followed one or more letters, digits or underscores all lowercase.
10+
{% endif %}
11+
package_short_description:
12+
type: str
13+
default: Short description of package
14+
# validator: >-
15+
# {% if '"' in package_short_description %}
16+
# package_short_description must not contain unescaped double quotes. Use \\" for double quotes.
17+
# {% endif %}
18+
keyword1:
19+
type: str
20+
default: keyword1
21+
keyword2:
22+
type: str
23+
default: keyword2
24+
version:
25+
type: str
26+
default: 0.1.0
27+
github_organization:
28+
type: str
29+
default: "<my-github-organization>"
30+
license:
31+
type: str
32+
choices:
33+
- "Apache Software License 2.0"
34+
- "MIT license"
35+
- "BSD license"
36+
- "ISC license"
37+
- "GNU General Public License v3 or later"
38+
- "GNU Lesser General Public License v3 or later"
39+
- "Not open source"
40+
default: "MIT license"
41+
full_name:
42+
type: str
43+
default: Jane Smith
44+
help: Enter your full name.
45+
# validator: >-
46+
# {% if '"' in full_name %}
47+
# full_name must not contain unescaped double quotes. Use \\" for double quotes.
48+
# {% endif %}
49+
email:
50+
type: str
51+
default: yourname@esciencecenter.nl
52+
copyright_holder:
53+
type: str
54+
default: Netherlands eScience Center
55+
code_of_conduct_email:
56+
type: str
57+
default: "{{ email }}"
58+
59+
_subdirectory: template
60+
61+
repository:
62+
default: git@github.com:{{ github_organization }}/{{ directory_name }}
63+
when: false
64+
65+
repository_url:
66+
default: https://github.com/{{ github_organization }}/{{ directory_name }}
67+
when: false
68+
69+
70+
# Optional questions

hooks/post_gen_project.py

Lines changed: 0 additions & 1 deletion
This file was deleted.

0 commit comments

Comments
 (0)