Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
5ac1451
docs: design spec for statically-typed config (drop donfig)
d-v-b Jun 25, 2026
a42e0da
docs: explain why the async_ alias is unavoidable
d-v-b Jun 25, 2026
6ff9f65
docs: implementation plan for statically-typed config
d-v-b Jun 25, 2026
e05905f
feat(config): add frozen dataclass schema and path helpers
d-v-b Jun 25, 2026
1d5a65e
feat(config): add env-var and YAML ingest
d-v-b Jun 25, 2026
bba06b6
fix(config): exclude ZARR_CONFIG meta-var from env ingest
d-v-b Jun 25, 2026
ba98ec7
feat(config): add typed proxy with get/set/reset and deprecations
d-v-b Jun 25, 2026
f407ec6
fix(config): keep context scope in sync on refresh
d-v-b Jun 25, 2026
7e75304
feat(config): replace donfig with typed config object
d-v-b Jun 25, 2026
aa63864
fix(config): make get() honor defaults for removed deprecated keys
d-v-b Jun 25, 2026
8559593
fix(config): tolerate unknown keys from env/YAML ingest
d-v-b Jun 25, 2026
e8b781b
build: drop donfig dependency, add pyyaml
d-v-b Jun 25, 2026
6cb60d5
test(config): drift-protection + typing assertions; docs + changelog
d-v-b Jun 25, 2026
126681f
fix(config): deep-merge YAML codecs and thread environ to config sear…
d-v-b Jun 25, 2026
c7760e7
test(config): correct tmp_path annotation to pathlib.Path
d-v-b Jun 25, 2026
f3a40cb
doc: rename changelog fragment to PR number 4101
d-v-b Jun 25, 2026
4b173ea
docs: remove superpowers design docs from branch
d-v-b Jun 25, 2026
96fcf95
test(config): refactor to table-driven Expect/ExpectFail cases
d-v-b Jun 25, 2026
9ac3c76
test(config): restore codecs in-place mutation guard in immutability …
d-v-b Jun 25, 2026
4e66915
test(config): verify get() overload return types match the schema
d-v-b Jun 25, 2026
033d117
docs(config): document why set() is not statically value-typed
d-v-b Jun 25, 2026
0379329
refactor(config): prefer object over Any for pass-through values
d-v-b Jun 25, 2026
095c4e0
Merge branch 'main' into statically-typed-config
d-v-b Jun 25, 2026
86c8bca
feat(config): suggest the closest key on an unknown config key
d-v-b Jun 25, 2026
ba646b3
feat(config): roster fallback for unknown keys; scope suggestion to l…
d-v-b Jun 25, 2026
fae7fac
test(config): drop tautological codec_pipeline default assertion
d-v-b Jun 26, 2026
d27ae88
Merge branch 'main' into statically-typed-config
d-v-b Jun 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions changes/4101.misc.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Replaced the `donfig`-based configuration with a statically-typed
configuration object. `zarr.config` now provides precise static types for
attribute access (`zarr.config.array.order`) and for the dotted-string API
(`zarr.config.get("array.order")`). The string API, environment-variable
ingestion (`ZARR_FOO__BAR`), YAML config files, `config.set` (permanent and
as a context manager), `config.reset`, `config.enable_gpu`, and the
`deprecations` mechanism are all preserved. The `donfig` dependency has been
removed.

Note: `zarr.config.defaults` now returns a nested `dict` directly; donfig
previously returned a one-element `list[dict]`, so callers that used
`config.defaults[0]` must be updated to use `config.defaults`.
19 changes: 9 additions & 10 deletions docs/user-guide/config.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# Runtime configuration

[`zarr.config`][] is responsible for managing the configuration of zarr and
is based on the [donfig](https://github.com/pytroll/donfig) Python library.
[`zarr.config`][] is a `ZarrConfigManager` instance that manages all runtime
settings for zarr. It provides both typed attribute access and a dotted-string
key API.

Configuration values can be set using code like the following:

Expand All @@ -18,12 +19,13 @@ zarr.config.set({'array.order': 'F'})
print(zarr.config.get('array.order'))
```

Alternatively, configuration values can be set using environment variables, e.g.
Alternatively, configuration values can be set using environment variables.
The variable name uses a `ZARR_` prefix, with `__` to denote nesting, e.g.
`ZARR_ARRAY__ORDER=F`.

The configuration can also be read from a YAML file in standard locations.
For more information, see the
[donfig documentation](https://donfig.readthedocs.io/en/latest/).
The configuration can also be read from YAML files. Place a `zarr.yaml` (or
any `.yaml`/`.yml` file) in `~/.config/zarr/`, or point the `ZARR_CONFIG`
environment variable at a specific file path.

Configuration options include the following:

Expand All @@ -46,8 +48,5 @@ This is the current default configuration:

```python exec="true" session="config" source="above" result="ansi"
from pprint import pprint
import io
output = io.StringIO()
zarr.config.pprint(stream=output, width=60)
print(output.getvalue())
pprint(zarr.config.to_dict())
```
2 changes: 1 addition & 1 deletion docs/user-guide/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Required dependencies include:
- [numcodecs](https://numcodecs.readthedocs.io) (0.14 or later)
- [google-crc32c](https://github.com/googleapis/python-crc32c) (1.5 or later)
- [typing_extensions](https://typing-extensions.readthedocs.io) (4.9 or later)
- [donfig](https://donfig.readthedocs.io) (0.8 or later)
- [pyyaml](https://pyyaml.org) (6 or later)

## pip

Expand Down
5 changes: 2 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ dependencies = [
'numcodecs>=0.14',
'google-crc32c>=1.5',
'typing_extensions>=4.14',
'donfig>=0.8',
'pyyaml>=6',
]

dynamic = [
Expand Down Expand Up @@ -242,7 +242,6 @@ extra-dependencies = [
's3fs @ git+https://github.com/fsspec/s3fs',
'universal_pathlib @ git+https://github.com/fsspec/universal_pathlib',
'typing_extensions @ git+https://github.com/python/typing_extensions',
'donfig @ git+https://github.com/pytroll/donfig',
'obstore @ git+https://github.com/developmentseed/obstore@main#subdirectory=obstore',
]

Expand All @@ -268,7 +267,7 @@ extra-dependencies = [
's3fs==2023.10.0',
'universal_pathlib==0.2.0',
'typing_extensions==4.14.*',
'donfig==0.8.*',
'pyyaml==6.*',
'obstore==0.5.*',
]

Expand Down
2 changes: 1 addition & 1 deletion src/zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def print_packages(packages: list[str]) -> None:
"numpy",
"numcodecs",
"typing_extensions",
"donfig",
"pyyaml",
]
optional = [
"botocore",
Expand Down
Loading
Loading