Skip to content

Commit 32b3291

Browse files
committed
Merge branch 'remove-vlen-utf8-warning' of https://github.com/d-v-b/zarr-python into remove-vlen-utf8-warning
2 parents 3de1d2c + 497b03b commit 32b3291

File tree

15 files changed

+141
-54
lines changed

15 files changed

+141
-54
lines changed

.github/ISSUE_TEMPLATE/release-checklist.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ assignees: ''
2525
- [ ] All tests pass in the ["GPU Tests" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/gpu_test.yml).
2626
- [ ] All tests pass in the ["Hypothesis" workflow](https://github.com/zarr-developers/zarr-python/actions/workflows/hypothesis.yaml).
2727
- [ ] Check that downstream libraries work well (maintainers can make executive decisions about whether all checks are required for this release).
28+
- [ ] numcodecs
2829
- [ ] Xarray (@jhamman @dcherian @TomNicholas)
2930
- Zarr's upstream compatibility is tested via the [Upstream Dev CI worklow](https://github.com/pydata/xarray/actions/workflows/upstream-dev-ci.yaml).
3031
- Click on the most recent workflow and check that the `upstream-dev` job has run and passed. `upstream-dev` is not run on all all workflow runs.

changes/+c563f4d4.bugfix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Register 'gpu' marker with pytest for downstream StoreTests.

changes/2819.chore.rst

Lines changed: 0 additions & 18 deletions
This file was deleted.

changes/3249.doc.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Expand the data type docs to include a demonstration of the ``parse_data_type`` function.
2+
Expand the docstring for the ``parse_data_type`` function.

changes/3251.fix.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Ensure that all abstract methods of ``ZDType`` raise a ``NotImplementedError`` when invoked.

docs/about.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Funding
1818
-------
1919
The project is fiscally sponsored by `NumFOCUS <https://numfocus.org/>`_, a US
2020
501(c)(3) public charity, and development is supported by the
21-
`MRC Centre for Genomics and Global Health <https://www.cggh.org>`_
21+
`MRC Centre for Genomics and Global Health <https://github.com/cggh/>`_
2222
and the `Chan Zuckerberg Initiative <https://chanzuckerberg.com/>`_.
2323

2424
.. _NumCodecs: https://numcodecs.readthedocs.io/

docs/conf.py

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,17 @@ def skip_submodules(
167167
# documentation.
168168
html_theme_options = {
169169
"github_url": "https://github.com/zarr-developers/zarr-python",
170-
"twitter_url": "https://twitter.com/zarr_dev",
171170
"icon_links": [
171+
{
172+
"name": "Bluesky",
173+
"url": "https://bsky.app/profile/zarr.dev",
174+
"icon": "fa-brands fa-bluesky",
175+
},
176+
{
177+
"name": "Mastodon",
178+
"url": "https://fosstodon.org/@zarr",
179+
"icon": "fa-brands fa-mastodon",
180+
},
172181
{
173182
"name": "Zarr Dev",
174183
"url": "https://zarr.dev/",
@@ -178,7 +187,6 @@ def skip_submodules(
178187
],
179188
"collapse_navigation": True,
180189
"navigation_with_keys": False,
181-
"announcement": "Zarr-Python 3 is here! Check out the release announcement <a href='https://zarr.dev/blog/zarr-python-3-release/'>here.</a>",
182190
}
183191

184192
# Add any paths that contain custom themes here, relative to this directory.

docs/release-notes.rst

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,24 @@ Release notes
88

99
Features
1010
~~~~~~~~
11-
11+
- Ensure that invocations of ``create_array`` use consistent keyword arguments, with consistent defaults.
12+
13+
``zarr.api.synchronous.create_array`` now takes a ``write_data`` keyword argument
14+
The ``Group.create_array`` method takes ``data`` and ``write_data`` keyword arguments.
15+
The functions ``api.asynchronous.create``, ``api.asynchronous.create_array``
16+
and the methods ``Group.create_array``, ``Group.array``, had the default
17+
``fill_value`` changed from ``0`` to the ``DEFAULT_FILL_VALUE`` value, which instructs Zarr to
18+
use the default scalar value associated with the array's data type as the fill value. These are
19+
all functions or methods for array creation that mirror, wrap or are wrapped by, another function
20+
that already has a default ``fill_value`` set to ``DEFAULT_FILL_VALUE``. This change is necessary
21+
to make these functions consistent across the entire codebase, but as this changes default values,
22+
new data might have a different fill value than expected after this change.
23+
24+
For data types where 0 is meaningful, like integers or floats, the default scalar is 0, so this
25+
change should not be noticeable. For data types where 0 is ambiguous, like fixed-length unicode
26+
strings, the default fill value might be different after this change. Users who were relying on how
27+
Zarr interpreted ``0`` as a non-numeric scalar value should set their desired fill value explicitly
28+
after this change.
1229
- Added public API for Buffer ABCs and implementations.
1330

1431
Use :mod:`zarr.buffer` to access buffer implementations, and

docs/user-guide/data_types.rst

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,4 +409,47 @@ We want to avoid a situation where the same native data type matches multiple Za
409409
a NumPy data type should *uniquely* specify a single Zarr data type. But data type resolution is
410410
dynamic, so it's not possible to statically guarantee this uniqueness constraint. Therefore, we
411411
attempt data type resolution against *every* data type class, and if, for some reason, a native data
412-
type matches multiple Zarr data types, we treat this as an error and raise an exception.
412+
type matches multiple Zarr data types, we treat this as an error and raise an exception.
413+
414+
If you have a NumPy data type and you want to get the corresponding ``ZDType`` instance, you can use
415+
the ``parse_data_type`` function, which will use the dynamic resolution described above. ``parse_data_type``
416+
handles a range of input types:
417+
418+
- NumPy data types:
419+
420+
.. code-block:: python
421+
422+
>>> import numpy as np
423+
>>> from zarr.dtype import parse_data_type
424+
>>> my_dtype = np.dtype('>M8[10s]')
425+
>>> parse_data_type(my_dtype, zarr_format=2)
426+
DateTime64(endianness='big', scale_factor=10, unit='s')
427+
428+
429+
- NumPy data type-compatible strings:
430+
431+
.. code-block:: python
432+
433+
>>> dtype_str = '>M8[10s]'
434+
>>> parse_data_type(dtype_str, zarr_format=2)
435+
DateTime64(endianness='big', scale_factor=10, unit='s')
436+
437+
- ``ZDType`` instances:
438+
439+
.. code-block:: python
440+
441+
>>> from zarr.dtype import DateTime64
442+
>>> zdt = DateTime64(endianness='big', scale_factor=10, unit='s')
443+
>>> parse_data_type(zdt, zarr_format=2) # Use a ZDType (this is a no-op)
444+
DateTime64(endianness='big', scale_factor=10, unit='s')
445+
446+
- Python dictionaries (requires ``zarr_format=3``). These dictionaries must be consistent with the
447+
``JSON`` form of the data type:
448+
449+
.. code-block:: python
450+
451+
>>> dt_dict = {"name": "numpy.datetime64", "configuration": {"unit": "s", "scale_factor": 10}}
452+
>>> parse_data_type(dt_dict, zarr_format=3)
453+
DateTime64(endianness='little', scale_factor=10, unit='s')
454+
>>> parse_data_type(dt_dict, zarr_format=3).to_json(zarr_format=3)
455+
{'name': 'numpy.datetime64', 'configuration': {'unit': 's', 'scale_factor': 10}}

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ exclude_lines = [
138138
[tool.coverage.run]
139139
omit = [
140140
"bench/compress_normal.py",
141+
"src/zarr/testing/conftest.py", # only for downstream projects
141142
]
142143

143144
[tool.hatch]
@@ -455,3 +456,6 @@ issue_format = ":issue:`{issue}`"
455456

456457
[tool.codespell]
457458
ignore-words-list = "astroid"
459+
460+
[project.entry-points.pytest11]
461+
zarr = "zarr.testing"

0 commit comments

Comments
 (0)