-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcopier.yaml
173 lines (155 loc) · 7.11 KB
/
copier.yaml
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
# Settings
_subdirectory: template
_jinja_extensions:
- copier_templates_extensions.TemplateExtensionLoader
- extensions/context.py:ContextUpdater
- extensions/slugify.py:SlugifyExtension
- extensions/is_installed.py:IsInstalledExtension
- extensions/is_valid.py:IsValidExtension
_tasks:
- command: ["{{ _copier_python }}", "tasks/git_init.py"]
when: "{{ git_init }}"
- command: ["{{ _copier_python }}", "tasks/create_templates.py"]
- command:
[
"{{ _copier_python }}",
"tasks/filter_requirements.py",
"{{ linter }}",
"{{ settings_manager }}",
"{{ features|join(' ') }}",
"{% if database == 'postgres' %}psycopg[binary]{% endif %}",
"{% if database == 'postgres' %}sqlalchemy{% endif %}",
"{% if 'cache-decorator' in features %}orjson{% endif %}",
]
- command: ["{{ _copier_python }}", "tasks/uv_install.py"]
when: "{{ package_manager == 'uv' }}"
- command: ["{{ _copier_python }}", "tasks/poetry_install.py", "{{ python_version }}"]
when: "{{ package_manager == 'poetry' }}"
- command: ["{{ _copier_python }}", "tasks/pip_install.py", "{{ python_version }}"]
when: "{{ package_manager == 'pip' }}"
- command: ["{{ _copier_python }}", "tasks/cleanup.py"]
# Answers
project_name:
type: str
help: "Enter your project's name"
placeholder: My Telegram Bot
validator: "{% if project_name.strip() == '' %}Project name cannot be empty{% endif %}"
project_slug:
type: str
help: "Enter your project's slug"
default: "{{ project_name|slugify }}"
validator: "{% if not project_slug.strip()|is_valid_slug %}Invalid project's slug (must contain only lowercase letters, numbers, and hyphens; no spaces or special characters allowed; cannot start or end with a hyphen){% endif %}"
project_version:
type: str
help: "Enter your project's version"
default: "0.1.0"
validator: "{% if not project_version.strip()|is_valid_version %}Invalid project's version (see PEP 440 https://peps.python.org/pep-0440/){% endif %}"
project_description:
type: str
help: "Describe your project briefly (optional)"
placeholder: Telegram bot that [main function] to help users [primary benefit]
project_author_name:
type: str
help: "Enter your full name (optional)"
placeholder: "John Doe"
project_author_email:
type: str
help: "Enter your email address (optional)"
placeholder: "user@example.com"
when: "{{ project_author_name.strip() != '' }}"
validator: "{% if project_author_email.strip() != '' and not project_author_email.strip()|is_valid_email %}Invalid email{% endif %}"
package_manager:
type: str
help: Which package manager do you want to use?
choices:
"uv | Blazing-fast Python package installer and resolver":
value: uv
validator: "{% if not 'uv'|is_installed %}not installed{% endif %}"
"Poetry | Python dependency management and packaging made easy":
value: poetry
validator: "{% if not 'poetry'|is_installed %}not installed{% endif %}"
"pip | Standard package installer for Python packages":
value: pip
validator: "{% if not 'pip'|is_installed %}not installed{% endif %}"
python_version:
type: str
help: What version of Python do you want to use?
choices:
"3.13":
value: "3.13"
validator: "{% if package_manager in ['poetry', 'pip'] and not '3.13'|is_installed %}not installed{% endif %}"
"3.12":
value: "3.12"
validator: "{% if package_manager in ['poetry', 'pip'] and not '3.12'|is_installed %}not installed{% endif %}"
"3.11":
value: "3.11"
validator: "{% if package_manager in ['poetry', 'pip'] and not '3.11'|is_installed %}not installed{% endif %}"
"3.10":
value: "3.10"
validator: "{% if package_manager in ['poetry', 'pip'] and not '3.10'|is_installed %}not installed{% endif %}"
"3.9":
value: "3.9"
validator: "{% if package_manager in ['poetry', 'pip'] and not '3.9'|is_installed %}not installed{% endif %}"
database:
type: str
help: Which database do you want to use?
choices:
"Postgres | Powerful open-source relational database with ACID compliance and advanced features":
value: "postgres"
"None | Do not configure a database for this project":
value: ""
features:
type: str
help: What features do you want to use?
multiselect: true
choices:
"Redis | Persistent key-value storage for maintaining bot state across restarts":
value: "redis"
"just | Handy way to save and run project-specific commands":
value: "just"
"Alembic | Database migration tool for SQLAlchemy to manage schema changes":
value: "alembic"
validator: "{% if not database %}No database selected{% endif %}"
"Aiogram Dialog | Framework for developing interactive messages and menus":
value: "aiogram-dialog"
"Cache Decorator | Cache results of frequent functions using Redis":
value: "cache-decorator"
validator: "{% if 'aiogram-dialog' in features and 'redis' not in features %}Redis is required to use Aiogram Dialog{% endif %}{% if 'cache-decorator' in features and 'redis' not in features %}Redis is required to use Cache Decorator{% endif %}"
middlewares:
type: str
help: Which middlewares do you want to use?
multiselect: true
choices:
"Dependency | Inject required dependencies into handler's data":
value: "dependency"
"Logging | Detailed logging of all telegram bot events and updates":
value: "logging"
"Throttling | Rate limit handling to prevent spam and abuse":
value: "throttling"
"Database | Database session management with transactional safety":
value: "database"
validator: "{% if not database %}No database selected{% endif %}"
"Callback Answer | Automatically answer callback queries":
value: "callback_answer"
validator: "{% if 'throttling' in middlewares and 'dependency' not in middlewares %}Dependency Middleware is required to use Throttling Middleware{% endif %}"
linter:
type: str
help: Which linter do you want to use?
choices:
"ruff | Blazing-fast Rust-based linter replacing Flake8, isort, and autoformatters":
value: "ruff"
"None | Skip linter configuration for this project":
value: ""
settings_manager:
type: str
help: Which settings manager do you want to use?
choices:
"Pydantic Settings | Modern type-safe configuration using Python type annotations":
value: "pydantic-settings"
"Dynaconf | Multi-source configuration manager with environment-aware settings":
value: "dynaconf"
git_init:
type: bool
help: Do you want to initialize git?
default: true
when: "{{ 'git'|is_installed }}"