Skip to content

Commit 570049e

Browse files
committed
Merge branch 'forman-82-config_setting_extra' into forman-85-config_setting_categories
# Conflicts: # CHANGES.md # zappend/config/markdown.py
2 parents 1a89b39 + 2a23449 commit 570049e

File tree

8 files changed

+296
-249
lines changed

8 files changed

+296
-249
lines changed

CHANGES.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
## Version 0.7.0 (in development)
22

3-
* Made writing custom slice sources easier: (#82)
3+
* Made writing custom slice sources easier and more flexible: (#82)
44

55
- Slice items can now be a `contextlib.AbstractContextManager`
66
so custom slice functions can now be used with
@@ -14,6 +14,9 @@
1414
contains keyword-arguments passed to a configured `slice_source` together with
1515
each slice item.
1616

17+
- Introduced optional configuration setting `extra` that holds additional
18+
configuration not validated by default. Intended use is by a `slice_source` that
19+
expects an argument named `ctx` and therefore can access the configuration.
1720
* Improved readability of the configuration reference by using setting categories.
1821

1922
## Version 0.6.0 (from 2024-03-12)

docs/config.md

Lines changed: 75 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,31 @@
11
# Configuration Reference
22

3-
In the following all possible configuration settings are described.
43

5-
## Target Outline
4+
## `version`
65

7-
### `append_dim`
6+
Configuration schema version. Allows the schema to evolve while still preserving backwards compatibility.
7+
Its value is `1`.
8+
Defaults to `1`.
9+
10+
## `zarr_version`
11+
12+
The Zarr version to be used.
13+
Its value is `2`.
14+
Defaults to `2`.
15+
16+
## `fixed_dims`
17+
18+
Type _object_.
19+
Specifies the fixed dimensions of the target dataset. Keys are dimension names, values are dimension sizes.
20+
The object's values are of type _integer_.
21+
22+
## `append_dim`
823

924
Type _string_.
1025
The name of the variadic append dimension.
1126
Defaults to `"time"`.
12-
### `append_step`
27+
28+
## `append_step`
1329

1430
If set, enforces a step size in the append dimension between two slices or just enforces a direction.
1531
Must be one of the following:
@@ -30,22 +46,20 @@ Must be one of the following:
3046
A positive or negative numerical delta value.
3147

3248
Defaults to `null`.
33-
### `fixed_dims`
3449

35-
Type _object_.
36-
Specifies the fixed dimensions of the target dataset. Keys are dimension names, values are dimension sizes.
37-
The object's values are of type _integer_.
38-
### `included_variables`
50+
## `included_variables`
3951

4052
Type _array_.
4153
Specifies the names of variables to be included in the target dataset. Defaults to all variables found in the first contributing dataset.
4254
The items of the array are of type _string_.
43-
### `excluded_variables`
55+
56+
## `excluded_variables`
4457

4558
Type _array_.
4659
Specifies the names of individual variables to be excluded from all contributing datasets.
4760
The items of the array are of type _string_.
48-
### `variables`
61+
62+
## `variables`
4963

5064
Type _object_.
5165
Defines dimensions, encoding, and attributes for variables in the target dataset. Object property names refer to variable names. The special name `*` refers to all variables, which is useful for defining common values.
@@ -135,11 +149,13 @@ Variable metadata.
135149
* `attrs`:
136150
Type _object_.
137151
Arbitrary variable metadata attributes.
138-
### `attrs`
152+
153+
## `attrs`
139154

140155
Type _object_.
141156
Arbitrary dataset attributes. If `permit_eval` is set to `true`, string values may include Python expressions enclosed in `{{` and `}}` to dynamically compute attribute values; in the expression, the current dataset is named `ds`. Refer to the user guide for more information.
142-
### `attrs_update_mode`
157+
158+
## `attrs_update_mode`
143159

144160
The mode used update target attributes from slice attributes. Independently of this setting, extra attributes configured by the `attrs` setting will finally be used to update the resulting target attributes.
145161
Must be one of the following:
@@ -157,37 +173,44 @@ Must be one of the following:
157173
Its value is `"ignore"`.
158174

159175
Defaults to `"keep"`.
160-
### `zarr_version`
161176

162-
The Zarr version to be used.
163-
Its value is `2`.
164-
Defaults to `2`.
165-
## Data I/O - Target
177+
## `permit_eval`
178+
179+
Type _boolean_.
180+
Allow for dynamically computed values in dataset attributes `attrs` using the syntax `{{ expression }}`. Executing arbitrary Python expressions is a security risk, therefore this must be explicitly enabled. Refer to the user guide for more information.
181+
Defaults to `false`.
166182

167-
### `target_dir`
183+
## `target_dir`
168184

169185
Type _string_.
170186
The URI or local path of the target Zarr dataset. Must specify a directory whose parent directory must exist.
171-
### `target_storage_options`
187+
188+
## `target_storage_options`
172189

173190
Type _object_.
174191
Options for the filesystem given by the URI of `target_dir`.
175-
### `force_new`
176192

177-
Type _boolean_.
178-
Force creation of a new target dataset. An existing target dataset (and its lock) will be permanently deleted before appending of slice datasets begins. WARNING: the deletion cannot be rolled back.
179-
Defaults to `false`.
180-
## Data I/O - Slices
193+
## `slice_source`
194+
195+
Type _string_.
196+
The fully qualified name of a class or function that receives a slice item as argument(s) and provides the slice dataset. If a class is given, it must be derived from `zappend.api.SliceSource`. If the function is a context manager, it must yield an `xarray.Dataset`. If a plain function is given, it must return any valid slice item type. Refer to the user guide for more information.
181197

182-
### `slice_storage_options`
198+
## `slice_source_kwargs`
183199

184200
Type _object_.
185-
Options for the filesystem given by the protocol of the URIs of contributing datasets.
186-
### `slice_engine`
201+
Extra keyword-arguments passed to a configured `slice_source` together with each slice item.
202+
203+
## `slice_engine`
187204

188205
Type _string_.
189206
The name of the engine to be used for opening contributing datasets. Refer to the `engine` argument of the function `xarray.open_dataset()`.
190-
### `slice_polling`
207+
208+
## `slice_storage_options`
209+
210+
Type _object_.
211+
Options for the filesystem given by the protocol of the URIs of contributing datasets.
212+
213+
## `slice_polling`
191214

192215
Defines how to poll for contributing datasets.
193216
Must be one of the following:
@@ -212,52 +235,36 @@ Must be one of the following:
212235
Polling timeout in seconds.
213236
Defaults to `60`.
214237

215-
### `slice_source`
216-
217-
Type _string_.
218-
The fully qualified name of a class or function that receives a slice item as argument(s) and provides the slice dataset. If a class is given, it must be derived from `zappend.api.SliceSource`. If the function is a context manager, it must yield an `xarray.Dataset`. If a plain function is given, it must return any valid slice item type. Refer to the user guide for more information.
219-
### `slice_source_kwargs`
220238

221-
Type _object_.
222-
Extra keyword-arguments passed to a configured `slice_source` together with each slice item.
223-
### `persist_mem_slices`
239+
## `persist_mem_slices`
224240

225241
Type _boolean_.
226242
Persist in-memory slices and reopen from a temporary Zarr before appending them to the target dataset. This can prevent expensive re-computation of dask chunks at the cost of additional i/o.
227243
Defaults to `false`.
228-
## Data I/O - Transactions
229244

230-
### `temp_dir`
245+
## `temp_dir`
231246

232247
Type _string_.
233248
The URI or local path of the directory that will be used to temporarily store rollback information.
234-
### `temp_storage_options`
249+
250+
## `temp_storage_options`
235251

236252
Type _object_.
237253
Options for the filesystem given by the protocol of `temp_dir`.
238-
### `disable_rollback`
254+
255+
## `force_new`
239256

240257
Type _boolean_.
241-
Disable rolling back dataset changes on failure. Effectively disables transactional dataset modifications, so use this setting with care.
258+
Force creation of a new target dataset. An existing target dataset (and its lock) will be permanently deleted before appending of slice datasets begins. WARNING: the deletion cannot be rolled back.
242259
Defaults to `false`.
243-
## Misc.
244260

245-
### `version`
246-
247-
Configuration schema version. Allows the schema to evolve while still preserving backwards compatibility.
248-
Its value is `1`.
249-
Defaults to `1`.
250-
### `dry_run`
261+
## `disable_rollback`
251262

252263
Type _boolean_.
253-
If `true`, log only what would have been done, but don't apply any changes.
264+
Disable rolling back dataset changes on failure. Effectively disables transactional dataset modifications, so use this setting with care.
254265
Defaults to `false`.
255-
### `permit_eval`
256266

257-
Type _boolean_.
258-
Allow for dynamically computed values in dataset attributes `attrs` using the syntax `{{ expression }}`. Executing arbitrary Python expressions is a security risk, therefore this must be explicitly enabled. Refer to the user guide for more information.
259-
Defaults to `false`.
260-
### `profiling`
267+
## `profiling`
261268

262269
Profiling configuration. Allows for runtime profiling of the processing.
263270
Must be one of the following:
@@ -305,7 +312,8 @@ Must be one of the following:
305312
Pattern-match the standard name that is printed.
306313

307314

308-
### `logging`
315+
316+
## `logging`
309317

310318
Logging configuration.
311319
Must be one of the following:
@@ -399,3 +407,14 @@ Must be one of the following:
399407
The items of the array are of type _string_.
400408

401409

410+
## `dry_run`
411+
412+
Type _boolean_.
413+
If `true`, log only what would have been done, but don't apply any changes.
414+
Defaults to `false`.
415+
416+
## `extra`
417+
418+
Type _object_.
419+
Extra settings. Intended use is by a `slice_source` that expects an argument named `ctx` to access the extra settings and other configuration.
420+

0 commit comments

Comments
 (0)