@@ -112,7 +112,10 @@ class Template:
112
112
113
113
@cached_property
114
114
def _raw_config (self ) -> AnyByStrDict :
115
- """Get template configuration, raw."""
115
+ """Get template configuration, raw.
116
+
117
+ It reads [the `copier.yml` file][the-copieryml-file].
118
+ """
116
119
result = load_config_data (self .local_abspath )
117
120
with suppress (KeyError ):
118
121
verify_minimum_version (result ["_min_copier_version" ])
@@ -123,6 +126,8 @@ def answers_relpath(self) -> Path:
123
126
"""Get the answers file relative path, as specified in the template.
124
127
125
128
If not specified, returns the default `.copier-answers.yml`.
129
+
130
+ See [answers_file][].
126
131
"""
127
132
result = Path (self .config_data .get ("answers_file" , ".copier-answers.yml" ))
128
133
assert not result .is_absolute ()
@@ -137,7 +142,11 @@ def commit(self) -> OptStr:
137
142
138
143
@cached_property
139
144
def config_data (self ) -> AnyByStrDict :
140
- """Get config from the template."""
145
+ """Get config from the template.
146
+
147
+ It reads [the `copier.yml` file][the-copieryml-file] to get its
148
+ [settings][available-settings].
149
+ """
141
150
return filter_config (self ._raw_config )[0 ]
142
151
143
152
@cached_property
@@ -147,7 +156,10 @@ def default_answers(self) -> AnyByStrDict:
147
156
148
157
@cached_property
149
158
def envops (self ) -> Mapping :
150
- """Get the Jinja configuration specified in the template, or default values."""
159
+ """Get the Jinja configuration specified in the template, or default values.
160
+
161
+ See [envops][].
162
+ """
151
163
# TODO Use Jinja defaults
152
164
result = {
153
165
"autoescape" : False ,
@@ -164,7 +176,10 @@ def envops(self) -> Mapping:
164
176
165
177
@cached_property
166
178
def exclude (self ) -> Tuple [str , ...]:
167
- """Get exclusions specified in the template, or default ones."""
179
+ """Get exclusions specified in the template, or default ones.
180
+
181
+ See [exclude][].
182
+ """
168
183
return tuple (self .config_data .get ("exclude" , DEFAULT_EXCLUDE ))
169
184
170
185
@cached_property
@@ -183,6 +198,8 @@ def migration_tasks(self, stage: str, from_: str, to: str) -> Sequence[Mapping]:
183
198
"""Get migration objects that match current version spec.
184
199
185
200
Versions are compared using PEP 440.
201
+
202
+ See [migrations][].
186
203
"""
187
204
result : List [dict ] = []
188
205
if not from_ or not to :
@@ -206,7 +223,10 @@ def migration_tasks(self, stage: str, from_: str, to: str) -> Sequence[Mapping]:
206
223
207
224
@cached_property
208
225
def questions_data (self ) -> AnyByStrDict :
209
- """Get questions from the template."""
226
+ """Get questions from the template.
227
+
228
+ See [questions][].
229
+ """
210
230
return filter_config (self ._raw_config )[1 ]
211
231
212
232
@cached_property
@@ -226,6 +246,8 @@ def skip_if_exists(self) -> StrSeq:
226
246
"""Get skip patterns from the template.
227
247
228
248
These files will never be rewritten when rendering the template.
249
+
250
+ See [skip_if_exists][].
229
251
"""
230
252
return self .config_data .get ("skip_if_exists" , ())
231
253
@@ -236,19 +258,26 @@ def subdirectory(self) -> str:
236
258
The subdirectory points to the real template code, allowing the
237
259
templater to separate it from other template assets, such as docs,
238
260
tests, etc.
261
+
262
+ See [subdirectory][].
239
263
"""
240
264
return self .config_data .get ("subdirectory" , "" )
241
265
242
266
@cached_property
243
267
def tasks (self ) -> Sequence :
244
- """Get tasks defined in the template."""
268
+ """Get tasks defined in the template.
269
+
270
+ See [tasks][].
271
+ """
245
272
return self .config_data .get ("tasks" , [])
246
273
247
274
@cached_property
248
275
def templates_suffix (self ) -> str :
249
276
"""Get the suffix defined for templates.
250
277
251
278
By default: `.tmpl`.
279
+
280
+ See [templates_suffix][].
252
281
"""
253
282
return self .config_data .get ("templates_suffix" , DEFAULT_TEMPLATES_SUFFIX )
254
283
0 commit comments