forked from browniebroke/pypackage-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopier.yml
More file actions
127 lines (107 loc) · 3.85 KB
/
Copy pathcopier.yml
File metadata and controls
127 lines (107 loc) · 3.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
# questions
full_name:
type: str
help: "What's your name?"
email:
type: str
help: "Email address"
placeholder: "first.last@example.com"
github_username:
type: str
help: "GitHub Username"
is_django_package:
type: bool
help: "Is the project a Django package?"
default: no
project_name:
type: str
help: "Project Name (human readable version){% if is_django_package %}, should start by 'Django'{% endif %}."
placeholder: "Python Package"
project_slug:
type: str
help: "Project slug (used for GitHub, PyPI, etc.){% if is_django_package %}, should start by 'django-'{% endif %}."
default: "{{ project_name.lower().replace(' ', '-') }}"
package_name:
type: str
help: "The name of the main Python package (should be a valid Python identifier{% if is_django_package %} and start by 'django_'{% endif %})"
default: "{{ project_slug.replace('-', '_') }}"
django_app_shorthand:
type: str
help: "The Django app shorthand, typically the package name without the 'django_' prefix."
default: "{{ package_name.removeprefix('django_') }}"
when: "{{ is_django_package }}"
project_short_description:
type: str
help: "A short description of the project"
placeholder: "A super helpful small Python package."
open_source_license:
type: str
help: "The open source license to use"
choices:
MIT: MIT
Apache Software License 2.0: Apache-2.0
GNU General Public License v3: GPL-3.0-only
Not open source: "Not open source"
copyright_year:
type: str
help: "Copyright year(s)"
default: "2025"
documentation:
type: bool
help: "Generate documentation?"
default: yes
has_cli:
type: bool
help: "Does the project have a CLI?"
default: no
cli_name:
type: str
help: "The name of the CLI"
default: "{{ project_slug }}"
when: "{{ has_cli }}"
run_uv_sync:
type: bool
help: "Run uv sync install after {{ package_name }} generation?"
default: no
initial_commit:
type: bool
help: "Create an initial commit with the generated {{ package_name }}?"
default: no
setup_github:
type: bool
help: "Setup GitHub repository (requires gh CLI)?"
default: no
setup_pre_commit:
type: bool
help: "Setup pre-commit hooks (requires prek)?"
default: no
add_me_as_contributor:
type: bool
help: "Add me as a contributor (requires npx)?"
default: no
when: "{{ initial_commit }}"
open_with_editor:
type: bool
help: "Open with code editor (requires environment variable EDITOR to be set to a valid command)"
default: no
# Copier metadata
_min_copier_version: "9.0.0"
_subdirectory: "project"
_tasks:
# Run 'uv sync' to generate/update lockfile
- "{% if run_uv_sync %}uv sync{% endif %}"
# Initial commit
- "{% if _copier_operation == 'copy' and initial_commit %}git init{% endif %}"
- "{% if _copier_operation == 'copy' and initial_commit %}git add .{% endif %}"
- '{% if _copier_operation == "copy" and initial_commit %}git commit -m "chore: initial commit"{% endif %}'
# Setup GitHub
- '{% if _copier_operation == "copy" and setup_github %}gh repo create {{ github_username }}/{{ project_slug }} -d "{{ project_short_description }}" --public --remote=origin --source=. --push{% endif %}'
- "{% if _copier_operation == 'copy' and setup_github %}gh repo edit --delete-branch-on-merge --enable-projects=false --enable-wiki=false{% endif %}"
- '{% if _copier_operation == "copy" and setup_github %}gh secret set GH_PAT -b "changeme"{% endif %}'
- '{% if _copier_operation == "copy" and setup_github %}gh secret set CODECOV_TOKEN -b "changeme"{% endif %}'
# Add me as a contributor
- "{% if _copier_operation == 'copy' and add_me_as_contributor %}npx --yes all-contributors-cli add {{ github_username }} code,ideas,doc{% endif %}"
# Setup pre-commit hooks using prek
- "{% if _copier_operation == 'copy' and setup_pre_commit %}prek install -f{% endif %}"
# Open with editor
- "{% if open_with_editor %}$EDITOR .{% endif %}"