Skip to content

Commit 52cd15a

Browse files
committed
enh(user experience): reorganize copier.yml template
enh: rename use_Default
1 parent 52e67f0 commit 52cd15a

File tree

2 files changed

+88
-73
lines changed

2 files changed

+88
-73
lines changed

copier.yml

Lines changed: 87 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
# This is the quick exit option for the template. It defaults to
2+
# basic package setup (and we will add basic tests and docs)
3+
template_mode:
4+
type: str
5+
help: |
6+
"Welcome to the pyOpenSci package template.
7+
Please select the type of template that you want to create today."
8+
choices:
9+
"Yes, but with a minimal setup (package, tests and docs; typing, linting not included).": "minimal"
10+
"I want to use the default settings but I want it setup for me. ": "full"
11+
"I want it all but I want to fully customize all elements of the template.": "custom" # changed from no to to custom
12+
13+
default: "minimal"
14+
15+
############### Basic Information ###################
16+
117
copyright_holder:
218
type: str
319
help: "Who is the copyright holder, for example, yourself or your organization? Used in the license file and project description."
420

521
author_name:
622
type: str
7-
help: "Who is the author of the package to be? Used in the package description."
23+
help: "Who is the author of the package? Used in the package description."
824
default: "{{ copyright_holder }}"
925

1026
author_email:
@@ -13,35 +29,48 @@ author_email:
1329

1430
project_name:
1531
type: str
16-
help: "What is the name of the project? Used as the title in the README.md and other places."
32+
help: "What is the name of the project? Used as the README.md title, in the Docs and other places."
1733

1834
package_description:
1935
type: str
2036
multiline: true
2137
help: "Please provide a short description for the package."
2238

39+
year:
40+
when: "{{ template_mode == 'custom' }}"
41+
type: str
42+
help: "What is the starting year of the project? Used in copyright statements."
43+
default: "{{ '%Y' | strftime }}"
44+
45+
license:
46+
when: "{{ template_mode == 'custom' }}"
47+
type: str
48+
help: |
49+
Which license do you want to use? Includes a LICENSE file in the repository root.
50+
For more information, see:
51+
- https://www.pyopensci.org/python-package-guide/documentation/repository-files/license-files.html
52+
- https://opensource.org/licenses
53+
choices:
54+
"Permissive - MIT": "MIT"
55+
"Permissive - BSD-3-Clause": "BSD-3-Clause"
56+
"Permissive - Apache-2.0": "Apache-2.0"
57+
"Copyleft - GPL-3.0": "GPL-3.0-only"
58+
"Copyleft - EUPL-1.2": "EUPL-1.2"
59+
"Intermediate - MPL-2.0": "MPL-2.0"
60+
default: MIT
61+
62+
############### All things related to vcs & git ###################
63+
2364
use_git:
24-
when: "{{ use_default == 'no' }}"
65+
when: "{{ template_mode == 'custom' }}"
2566
type: bool
2667
default: "yes"
2768
help: "Do you want to use git version control with a development platform, like GitHub or GitLab?"
2869

29-
30-
# This is the quick exit option for the template. It defaults to
31-
# basic package setup (and we will add basic tests and docs)
32-
use_default:
33-
type: str
34-
help: "Do you want to answer one more question, and skip the rest, using the default values?"
35-
choices:
36-
"No, I want to fully customize the template.": "no"
37-
"Yes, with all the bells and whistles.": "full"
38-
"Yes, but with a minimal setup (package, tests and docs only).": "minimal"
39-
default: "minimal"
40-
4170
dev_platform:
42-
when: "{{ use_default == 'no' and use_git }}"
71+
when: "{{ template_mode == 'custom' and use_git }}"
4372
type: str
44-
help: "Which development platform are you planning to use? Used to generate certain documentation and hyperlinks."
73+
help: "Which development platform are you planning to use? Used in documentation links."
4574
choices:
4675
- "GitHub"
4776
- "GitLab"
@@ -52,103 +81,89 @@ username:
5281
type: str
5382
help: "Provide you or your organization's {{ dev_platform }} username. Used to generate certain documentation and hyperlinks."
5483

55-
56-
documentation:
57-
when: "{{ use_default == 'no' }}"
84+
dev_platform_url:
5885
type: str
59-
help: "Do you want to include documentation for your project and which framework do you want to use?"
60-
choices:
61-
"Sphinx (https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html)": sphinx
62-
"mkdocs-material (https://squidfunk.github.io/mkdocs-material)": mkdocs
63-
"No, I don't need documentation for my project.": "no"
64-
default: "{% if use_default != 'no' %}sphinx{% endif %}"
86+
when: false
87+
default: "https://{{ dev_platform|lower }}.com"
6588

66-
use_rtd:
67-
when: "{{ use_default == 'no' }}"
68-
type: bool
69-
default: "{% if use_default != 'minimal' %}yes{% else %}no{% endif %}"
70-
help: "Do you want to read the docs to publish your documentation?"
89+
############### Things related to packaging ###################
7190

7291
project_slug:
73-
when: "{{ use_default == 'no' }}"
92+
when: "{{ template_mode == 'custom' }}"
7493
type: str
7594
help: "What is the project slug? Used in hyperlinks."
7695
default: "{{ project_name|lower|replace(' ', '-') }}"
7796

7897
package_name:
79-
when: "{{ use_default == 'no' }}"
98+
when: "{{ template_mode == 'custom' }}"
8099
type: str
81100
help: "What is the Python package name? Used as the name of the package and the top-level import."
82101
default: "{{ project_slug|replace('-', '_') }}"
83102

84103
use_vcs_version:
85-
when: "{{ use_default == 'no' }}"
104+
when: "{{ template_mode == 'custom' }}"
86105
type: bool
87-
default: "{% if use_default != 'minimal' %}yes{% else %}no{% endif %}"
106+
default: "{% if template_mode != 'minimal' %}yes{% else %}no{% endif %}"
88107
help: "Do you want to use dynamic versioning of your package or static? Dynamic means that versions use your version control system (VCS), such as git tags, for creating versions."
89108

90-
dev_platform_url:
91-
type: str
92-
when: false
93-
default: "https://{{ dev_platform|lower }}.com"
94-
95109
python_package_name:
96110
type: str
97111
when: false
98112
default: "{{ project_slug|lower|replace('-', '_') if project_slug else project_name|lower|replace('-', '_') }}"
99113

114+
############### Things related to docs ###################
115+
116+
documentation:
117+
when: "{{ template_mode == 'custom' }}"
118+
type: str
119+
help: "Do you want to include documentation for your project and which framework do you want to use?"
120+
choices:
121+
"Sphinx (https://pydata-sphinx-theme.readthedocs.io/en/stable/index.html)": sphinx
122+
"mkdocs-material (https://squidfunk.github.io/mkdocs-material)": mkdocs
123+
"No, I don't need documentation for my project.": "no"
124+
default: "{% if template_mode != 'no' %}sphinx{% endif %}"
125+
126+
use_rtd:
127+
when: "{{ template_mode == 'custom' }}"
128+
type: bool
129+
default: "{% if template_mode != 'minimal' %}yes{% else %}no{% endif %}"
130+
help: "Do you want to Read the Docs to publish your documentation?"
131+
132+
################ Packaging tools and settings ###################
133+
100134
use_hatch_envs:
101-
when: "{{ use_default == 'no' }}"
135+
when: "{{ template_mode == 'custom' }}"
102136
type: bool
103137
default: "yes"
104-
help: "Do you want to use hatch environments for running isolated commands like linting, building docs, or testing?"
138+
help: "Do you want to use hatch environments for running isolated commands like linting, building docs, and testing?"
139+
140+
################ Linting, style, typing and format thangs ###################
105141

106142
use_lint:
107-
when: "{{ use_default == 'no' }}"
143+
when: "{{ template_mode == 'custom' }}"
108144
type: bool
109-
default: "{% if use_default != 'minimal' %}yes{% else %}no{% endif %}"
145+
default: "{% if template_mode != 'minimal' %}yes{% else %}no{% endif %}"
110146
help: "Do you want to lint your code and check file formatting?"
111147

112148
use_precommit:
113-
when: "{{ use_default == 'no' }}"
149+
when: "{{ template_mode == 'custom' }}"
114150
type: bool
115-
default: "{% if use_default != 'minimal' %}yes{% else %}no{% endif %}"
151+
default: "{% if template_mode != 'minimal' %}yes{% else %}no{% endif %}"
116152
help: "Do you want to pre-commit hooks to format your code on save?"
117153

118154
use_types:
119-
when: "{{ use_default == 'no' }}"
155+
when: "{{ template_mode == 'custom' }}"
120156
type: bool
121-
default: "{% if use_default != 'minimal' %}yes{% else %}no{% endif %}"
157+
default: "{% if template_mode != 'minimal' %}yes{% else %}no{% endif %}"
122158
help: "Do you want to use typing annotations and type check your code?"
123159

124-
# Default to a basic test suite
160+
############### All things related to testing ###################
161+
125162
use_test:
126-
when: "{{ use_default == 'no' }}"
163+
when: "{{ template_mode == 'custom' }}"
127164
type: bool
128165
default: "yes"
129166
help: "Do you want to test your code? We strongly recommend that you add tests to your package."
130167

131-
license:
132-
when: "{{ use_default == 'no' }}"
133-
type: str
134-
help: |
135-
Which license do you want to use? Includes a LICENSE file in the repository root.
136-
For more information, see:
137-
- https://www.pyopensci.org/python-package-guide/documentation/repository-files/license-files.html
138-
- https://opensource.org/licenses
139-
choices:
140-
"Permissive - MIT": "MIT"
141-
"Permissive - BSD-3-Clause": "BSD-3-Clause"
142-
"Permissive - Apache-2.0": "Apache-2.0"
143-
"Copyleft - GPL-3.0": "GPL-3.0-only"
144-
"Copyleft - EUPL-1.2": "EUPL-1.2"
145-
"Intermediate - MPL-2.0": "MPL-2.0"
146-
default: MIT
147-
148-
year:
149-
when: "{{ use_default == 'no' }}"
150-
type: str
151-
help: "What is the starting year of the project? Used in copyright statements."
152-
default: "{{ '%Y' | strftime }}"
153168

154169
_subdirectory: "template"

tests/test_template_init.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def answers() -> dict[str, str]:
7272
"package_description": "Wubba Lubba Dub-Dub",
7373
"username": "rickprime",
7474
"year": str(today.year),
75-
"use_default": "no",
75+
"template_mode": "full",
7676
}
7777

7878

0 commit comments

Comments
 (0)