-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcopier.yml
More file actions
146 lines (117 loc) · 4.62 KB
/
copier.yml
File metadata and controls
146 lines (117 loc) · 4.62 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
# questions
organization:
type: str
help: |
GitHub organization or username for this repository.
E.g., "microsoft", "your_username", "your_organization", etc.
default: microsoft
project_name:
type: str
help: What is your project name?
validator: >-
{% if not (project_name | regex_search('^[a-zA-Z_][a-zA-Z0-9\-_]*$')) %}
project_name must start with a letter, followed by one or more letters, digits, dashes or underscores.
{% endif %}
module_name:
type: str
help: What is your Python module name? Can be the same as your project's name.
default: "{{ project_name|lower|replace(' ', '_')|replace('-', '_') }}"
validator: >-
{% if not (module_name | regex_search('^[a-zA-Z_][a-zA-Z0-9_]*')) %}
project_name must start with a letter, followed by one or more letters, digits or underscores.
{% endif %}
documentation:
type: bool
help: |
Do you want to include documentation in your project?
This will add a `docs` directory with mkdocs setup and CI builds.
default: false
precommit:
type: bool
help: |
Do you want to include pre-commit hooks in your project?
This will add a `.pre-commit-config.yaml` file with some basic hooks.
default: false
commitizen:
type: bool
help: |
Do you want to include commitizen in your project?
This will add a `.cz.toml` file and `commitizen` hooks to .pre-commit-config.yaml (if used).
default: false
microsoft_internal:
type: bool
help: If the project belongs to a Microsoft internal organization
when: "{{ false }}"
default: "{{ organization in ['microsoft', 'technology-and-research', 'health-futures', 'ai4science', 'msr-cambridge-uk'] }}"
license:
type: str
when: "{{not microsoft_internal}}"
help: |
What is the copyright holder for the generated LICENSE? Your Name, Your Organization, etc.
default: "{% if not microsoft_internal %}{{organization}}{% else %}Microsoft Corporation{% endif %}"
repo_exists:
type: bool
help: |
Does this repository already exist on GitHub? This question will give you instructions
create your repository on GitHub later on.
default: false
_min_copier_version: 9.6.0
_preserve_symlinks: true
_exclude:
- copier.yml
- CHANGELOG.md
- src/cookie
- test/test_cookie
- dist
- uv.lock
- .git
- .tmp
- .venv
- "{% if not documentation %}docs{% endif %}"
- "{% if not documentation %}mkdocs.yml{% endif %}"
- "{% if not documentation %}.github/workflows/docs.yml{% endif %}"
- "{% if not documentation %}bin/build-docs{% endif %}.jinja"
- "{% if not documentation %}bin/serve-docs{% endif %}"
- "{% if not commitizen %}.cz.toml{% endif %}"
- "{% if not precommit %}.github/workflows/pre-commit.yml{% endif %}"
- "{% if not precommit %}.pre-commit-config.yaml{% endif %}"
- "{% if not microsoft_internal %}.azure-pipelines{% endif %}"
- "{% if not microsoft_internal %}SECURITY.md{% endif %}"
_message_after_copy: |
Your project "{{ project_name }}" has been created successfully! 🎉
Required dependencies:
* Make sure you have `uv` installed.
* Instructions: https://microsoft.github.io/cookie-doh/dev_setup
* You can also install optional tools like `direnv` and `pre-commit` following the link above
if needed for your project.
Next steps:
1. Change directory and initialize GitHub:
$ cd {{ _copier_conf.dst_path }} # direnv will ask you to type `direnv allow` (if you have direnv installed)
$ git init
{% if repo_exists -%}
2. Pull repository into your newly created project:
$ git remote add origin https://github.com/{{ organization }}/{{ project_name }}.git
$ git pull origin main # and resolve any conflicts
{% else -%}
2. Create a new repository on GitHub:
a. Install the GitHub CLI (if you haven't already): https://cli.github.com/
b. Authenticate with GitHub and create the new repository:
$ gh auth login
$ gh repo create {{ organization }}/{{ project_name }} --private --source=. --remote=origin
$ cd {{ _copier_conf.dst_path }}
{% endif -%}
3. Add project dependencies to `pyproject.toml` with uv:
$ uv add <new-dependencies>
4. Add the project outputs, configure pre-commit and commit your changes:
$ git add .
{% if precommit -%}
uv tool install pre-commit --with pre-commit-uv
pre-commit install --install-hooks
{% endif -%}
$ git commit -m "init: initialize repo"
5. Happy coding! 🚀
_message_after_update: |
Your project "{{ project_name }}" has been updated! 🎉
In case there are any conflicts, please resolve them. Then, you're done! 🚀
_message_before_copy: |
💃 Thanks for generating a project using our template! 🕺