-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcopier.yml
More file actions
244 lines (209 loc) · 6.62 KB
/
copier.yml
File metadata and controls
244 lines (209 loc) · 6.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
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
algorithm_name:
type: str
help: What is your algorithm name?
validator: |-
{% if algorithm_name == 'test' %}
Algorithm name cannot be 'test'. This conflicts with generated test files.
{% endif %}
algorithm_description:
type: str
help: Please enter a short description (one sentence) of your algorithm.
open_source_license:
type: str
help: "The open source license to use"
choices:
"MIT": mit
"Apache Software License 2.0": apache
"GNU General Public License v3": gpl
"No license (you can add one later)": no_license
# ------------- Define central algorithm function ---------- #
has_central_function:
type: bool
help: "Do you want to use a central function in your algorithm?"
default: true
central_function_name:
type: str
when: "{{ has_central_function }}"
help: "What is the name of your central function?"
default: central
central_function_client:
type: bool
when: "{{ has_central_function }}"
help: "Do you want to use a client in your central function?"
default: true
central_function_data:
type: bool
when: "{{ has_central_function }}"
help: "Do you want to use data in your central function?"
default: false
central_function_number_databases:
type: int
when: "{{ has_central_function and central_function_data }}"
help: "How many databases do you want to use in your central function?"
default: |-
{%- if has_central_function and central_function_data -%}
1
{%- else -%}
0
{%- endif -%}
validator: |-
{% if central_function_data and central_function_number_databases < 1 %}
Must be at least 1
{% endif %}
central_args:
type: json
when: "{{ has_central_function }}"
help: "Add a list of arguments to the central function '{{ central_function_name }}'"
default: ['arg1', ]
multiline: true
# ------------- Define partial algorithm function ---------- #
has_partial_function:
type: bool
help: "Do you want to use a partial function in your algorithm?"
default: true
partial_function_name:
type: str
when: "{{ has_partial_function }}"
help: "What is the name of your partial function?"
default: partial
partial_function_client:
type: bool
when: "{{ has_partial_function }}"
help: "Do you want to use a client in your partial function?"
default: false
partial_function_data:
type: bool
when: "{{ has_partial_function }}"
help: "Do you want to use data in your partial function?"
default: true
partial_function_number_databases:
type: int
when: "{{ has_partial_function and partial_function_data }}"
help: "How many databases do you want to use in your partial function?"
default: |-
{%- if has_partial_function and partial_function_data -%}
1
{%- else -%}
0
{%- endif -%}
validator: |-
{% if has_partial_function and partial_function_number_databases < 1 %}
Must be at least 1
{% endif %}
partial_args:
type: json
when: "{{ has_partial_function }}"
help: "Add a list of arguments to the partial function '{{ partial_function_name }}'"
default: ['arg1', ]
multiline: true
# ----------------------- Documentation --------------------- #
has_docs:
type: bool
help: "Do you want to add documentation to your algorithm?"
default: true
project_name:
type: str
when: "{{ has_docs }}"
help: "What is the name of your project?"
default: "{{ algorithm_name }}"
author:
type: str
when: "{{ has_docs }}"
help: "Who are the authors of the project?"
copyright:
type: str
when: "{{ has_docs }}"
help: "Please add a copyright message to include in the documentation."
# ----------------------- Advanced ------------------------- #
advanced:
type: bool
help: "Do you want to see the advanced options?"
default: true
# ----------------------- Set up VPN ----------------------- #
use_vpn:
type: bool
when: "{{ advanced }}"
help: "Do you want to use the VPN network in your algorithm?"
default: false
vpn_expose:
type: json
when: "{{ advanced and use_vpn }}"
help: |
Configure the ports to expose in the VPN. You can add multiple ports
by adding more dictionaries with keys 'label' and 'port'.
default: [{'port': 8888, 'label': 'my_label'}]
multiline: true
validator: |
{% for port_dict in vpn_expose %}
{% if 'port' not in port_dict %}
Each dictionary should have a 'port' key.
{% endif %}
{% if 'label' not in port_dict %}
Each dictionary should have a 'label' key.
{% endif %}
{% endfor %}
has_gh_pipeline:
type: bool
when: "{{ advanced }}"
help: "Do you want to use GitHub Actions for CI/CD?"
default: "{{advanced}}"
private_registry:
type: bool
when: "{{ advanced and has_gh_pipeline }}"
help: "Do you want to use a private Docker registry?"
default: |-
{%- if advanced and has_gh_pipeline -%}
true
{%- else -%}
false
{%- endif -%}
docker_registry:
type: str
when: "{{ advanced and has_gh_pipeline and private_registry }}"
help: "The Docker registry to use for the GitHub Actions pipeline"
default: harbor2.vantage6.ai
docker_image:
type: str
when: "{{ advanced and has_gh_pipeline }}"
help: "The Docker image name to use for the GitHub Actions pipeline"
default: |-
{%- if private_registry -%}
{{docker_registry}}/{{algorithm_name}}
{%- else -%}
{{algorithm_name}}
{%- endif -%}
# ----------------------- Copier metadata ------------------ #
# Additional copier metadata
_min_copier_version: "8.0.0"
_tasks:
# Remove license file if no license
# TODO this doesn't work yet on Windows, no 'rm' command... Maybe we can
# find an easier solution by handling this in the `v6 algorithm` command
# - >-
# {% if _copier_conf.os in ['linux', 'macos'] %}
# {% if open_source_license == 'no_license' %}
# rm LICENSE
# {% endif %}
# {% elif _copier_conf.os == 'windows' %}
# Remove-Item LICENSE
# {% endif %}
# TODO: similarly, delete if empty: central.py, partial.py
# Call python script that cleans up
- ["{{ _copier_python }}", cleanup.py]
_message_after_copy: |
Your algorithm template "{{ algorithm_name }}" has been created successfully!
Checkout the README.md file for more information on how to get started. It
contains a checklist to help you further develop your algorithm.
_message_before_copy: |
Welcome to the vantage6 algorithm template creator!
You will be asked a series of questions to generate the basis of your new
vantage6 algorithm in Python.
_envops:
# Jinja settings to remove whitespace
lstrip_blocks: true
trim_blocks: true
_exclude:
# exclude jinja macro files from being copied to algorithm
- macros
- .git
- copier.yml