Skip to content

Commit 3d1d043

Browse files
committed
Merge branch 'main' of github.com:zarr-developers/zarr-python into feat/store-paths
2 parents 1bd1714 + c8cd147 commit 3d1d043

31 files changed

+770
-203
lines changed

.github/workflows/gpu_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
strategy:
2626
matrix:
2727
python-version: ['3.11']
28-
numpy-version: ['2.0']
28+
numpy-version: ['2.1']
2929
dependency-set: ["minimal"]
3030

3131
steps:

.github/workflows/hypothesis.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
strategy:
2727
matrix:
2828
python-version: ['3.11']
29-
numpy-version: ['1.26']
29+
numpy-version: ['2.1']
3030
dependency-set: ["optional"]
3131

3232
steps:

.github/workflows/test.yml

Lines changed: 54 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,33 @@ concurrency:
1616

1717
jobs:
1818
test:
19-
name: py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
19+
name: os=${{ matrix.os }}, py=${{ matrix.python-version }}, np=${{ matrix.numpy-version }}, deps=${{ matrix.dependency-set }}
2020

21-
runs-on: ubuntu-latest
2221
strategy:
2322
matrix:
2423
python-version: ['3.11', '3.12', '3.13']
25-
numpy-version: ['1.25', '1.26', '2.0']
24+
numpy-version: ['1.25', '2.1']
2625
dependency-set: ["minimal", "optional"]
26+
os: ["ubuntu-latest"]
27+
include:
28+
- python-version: '3.11'
29+
numpy-version: '1.25'
30+
dependency-set: 'optional'
31+
os: 'macos-latest'
32+
- python-version: '3.13'
33+
numpy-version: '2.1'
34+
dependency-set: 'optional'
35+
os: 'macos-latest'
36+
# https://github.com/zarr-developers/zarr-python/issues/2438
37+
# - python-version: '3.11'
38+
# numpy-version: '1.25'
39+
# dependency-set: 'optional'
40+
# os: 'windows-latest'
41+
# - python-version: '3.13'
42+
# numpy-version: '2.1'
43+
# dependency-set: 'optional'
44+
# os: 'windows-latest'
45+
runs-on: ${{ matrix.os }}
2746

2847
steps:
2948
- uses: actions/checkout@v4
@@ -43,3 +62,35 @@ jobs:
4362
- name: Run Tests
4463
run: |
4564
hatch env run --env test.py${{ matrix.python-version }}-${{ matrix.numpy-version }}-${{ matrix.dependency-set }} run
65+
66+
test-upstream-and-min-deps:
67+
name: py=${{ matrix.python-version }}-${{ matrix.dependency-set }}
68+
69+
runs-on: ubuntu-latest
70+
strategy:
71+
matrix:
72+
python-version: ['3.11', "3.13"]
73+
dependency-set: ["upstream", "min_deps"]
74+
exclude:
75+
- python-version: "3.13"
76+
dependency-set: min_deps
77+
- python-version: "3.11"
78+
dependency-set: upstream
79+
steps:
80+
- uses: actions/checkout@v4
81+
- name: Set up Python
82+
uses: actions/setup-python@v5
83+
with:
84+
python-version: ${{ matrix.python-version }}
85+
cache: 'pip'
86+
- name: Install Hatch
87+
run: |
88+
python -m pip install --upgrade pip
89+
pip install hatch
90+
- name: Set Up Hatch Env
91+
run: |
92+
hatch env create ${{ matrix.dependency-set }}
93+
hatch env run -e ${{ matrix.dependency-set }} list-env
94+
- name: Run Tests
95+
run: |
96+
hatch env run --env ${{ matrix.dependency-set }} run

.pep8speaks.yml

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

.pre-commit-config.yaml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ default_language_version:
77
python: python3
88
repos:
99
- repo: https://github.com/astral-sh/ruff-pre-commit
10-
rev: v0.6.9
10+
rev: v0.7.0
1111
hooks:
1212
- id: ruff
1313
args: ["--fix", "--show-fixes"]
@@ -22,7 +22,7 @@ repos:
2222
hooks:
2323
- id: check-yaml
2424
- repo: https://github.com/pre-commit/mirrors-mypy
25-
rev: v1.11.2
25+
rev: v1.12.1
2626
hooks:
2727
- id: mypy
2828
files: src|tests
@@ -37,8 +37,6 @@ repos:
3737
- universal-pathlib
3838
# Tests
3939
- pytest
40-
# Zarr v2
41-
- types-redis
4240
- repo: https://github.com/scientific-python/cookie
4341
rev: 2024.08.19
4442
hooks:

docs/guide/storage.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ that implements the `AbstractFileSystem` API,
7272
.. code-block:: python
7373
7474
>>> import zarr
75-
>>> store = zarr.storage.RemoteStore("gs://foo/bar", mode="r")
75+
>>> store = zarr.storage.RemoteStore.from_url("gs://foo/bar", mode="r")
7676
>>> zarr.open(store=store)
7777
<Array <RemoteStore(GCSFileSystem, foo/bar)> shape=(10, 20) dtype=float32>
7878

pyproject.toml

Lines changed: 71 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,13 @@ requires-python = ">=3.11"
2828
dependencies = [
2929
'asciitree',
3030
'numpy>=1.25',
31-
'numcodecs>=0.10.2',
32-
'fsspec>2024',
33-
'crc32c',
34-
'typing_extensions',
35-
'donfig',
31+
'numcodecs>=0.13',
32+
'fsspec>=2022.10.0',
33+
'crc32c>=2.3',
34+
'typing_extensions>=4.6',
35+
'donfig>=0.8',
3636
]
37+
3738
dynamic = [
3839
"version",
3940
]
@@ -60,7 +61,6 @@ test = [
6061
"pytest",
6162
"pytest-cov",
6263
"msgpack",
63-
"lmdb",
6464
"s3fs",
6565
"pytest-asyncio",
6666
"moto[s3]",
@@ -83,22 +83,20 @@ gpu = [
8383
docs = [
8484
'sphinx==8.1.3',
8585
'sphinx-autobuild>=2021.3.14',
86-
'sphinx-autoapi==3.3.2',
86+
'sphinx-autoapi==3.3.3',
8787
'sphinx_design',
8888
'sphinx-issues',
8989
'sphinx-copybutton',
9090
'pydata-sphinx-theme',
9191
'numpydoc',
9292
'numcodecs[msgpack]',
9393
'msgpack',
94-
'lmdb',
9594
]
9695
extra = [
9796
'msgpack',
9897
]
9998
optional = [
100-
'lmdb',
101-
'universal-pathlib',
99+
'universal-pathlib>=0.0.22',
102100
]
103101

104102
[project.urls]
@@ -134,17 +132,17 @@ features = ["test", "extra"]
134132

135133
[[tool.hatch.envs.test.matrix]]
136134
python = ["3.11", "3.12", "3.13"]
137-
numpy = ["1.25", "1.26", "2.0"]
135+
numpy = ["1.25", "2.1"]
138136
version = ["minimal"]
139137

140138
[[tool.hatch.envs.test.matrix]]
141139
python = ["3.11", "3.12", "3.13"]
142-
numpy = ["1.25", "1.26", "2.0"]
140+
numpy = ["1.25", "2.1"]
143141
features = ["optional"]
144142

145143
[[tool.hatch.envs.test.matrix]]
146144
python = ["3.11", "3.12", "3.13"]
147-
numpy = ["1.25", "1.26", "2.0"]
145+
numpy = ["1.25", "2.1"]
148146
features = ["gpu"]
149147

150148
[tool.hatch.envs.test.scripts]
@@ -165,7 +163,7 @@ features = ["test", "extra", "gpu"]
165163

166164
[[tool.hatch.envs.gputest.matrix]]
167165
python = ["3.11", "3.12", "3.13"]
168-
numpy = ["1.25", "1.26", "2.0"]
166+
numpy = ["1.25", "2.1"]
169167
version = ["minimal"]
170168

171169
[tool.hatch.envs.gputest.scripts]
@@ -183,6 +181,65 @@ features = ['docs']
183181
build = "cd docs && make html"
184182
serve = "sphinx-autobuild docs docs/_build --host 0.0.0.0"
185183

184+
[tool.hatch.envs.upstream]
185+
python = "3.13"
186+
dependencies = [
187+
'numpy', # from scientific-python-nightly-wheels
188+
'numcodecs @ git+https://github.com/zarr-developers/numcodecs',
189+
'fsspec @ git+https://github.com/fsspec/filesystem_spec',
190+
's3fs @ git+https://github.com/fsspec/s3fs',
191+
'universal_pathlib @ git+https://github.com/fsspec/universal_pathlib',
192+
'crc32c @ git+https://github.com/ICRAR/crc32c',
193+
'typing_extensions @ git+https://github.com/python/typing_extensions',
194+
'donfig @ git+https://github.com/pytroll/donfig',
195+
# test deps
196+
'hypothesis',
197+
'pytest',
198+
'pytest-cov',
199+
'pytest-asyncio',
200+
'moto[s3]',
201+
]
202+
203+
[tool.hatch.envs.upstream.env-vars]
204+
PIP_INDEX_URL = "https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/"
205+
PIP_EXTRA_INDEX_URL = "https://pypi.org/simple/"
206+
PIP_PRE = "1"
207+
208+
[tool.hatch.envs.upstream.scripts]
209+
run = "pytest --verbose"
210+
run-mypy = "mypy src"
211+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
212+
list-env = "pip list"
213+
214+
[tool.hatch.envs.min_deps]
215+
description = """Test environment for minimum supported dependencies
216+
217+
See Spec 0000 for details and drop schedule: https://scientific-python.org/specs/spec-0000/
218+
"""
219+
python = "3.11"
220+
dependencies = [
221+
'numpy==1.25.*',
222+
'numcodecs==0.13.*', # 0.13 needed for? (should be 0.11)
223+
'fsspec==2022.10.0',
224+
's3fs==2022.10.0',
225+
'universal_pathlib==0.0.22',
226+
'crc32c==2.3.*',
227+
'typing_extensions==4.6.*', # 4.5 needed for @deprecated, 4.6 for Buffer
228+
'donfig==0.8.*',
229+
# test deps
230+
'hypothesis',
231+
'pytest',
232+
'pytest-cov',
233+
'pytest-asyncio',
234+
'moto[s3]',
235+
]
236+
237+
[tool.hatch.envs.min_deps.scripts]
238+
run = "pytest --verbose"
239+
run-hypothesis = "pytest --hypothesis-profile ci tests/test_properties.py tests/test_store/test_stateful*"
240+
list-env = "pip list"
241+
242+
186243
[tool.ruff]
187244
line-length = 100
188245
force-exclude = true

src/zarr/abc/store.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ def with_mode(self, mode: AccessModeLiteral) -> Self:
184184
185185
Returns
186186
-------
187-
store:
187+
store
188188
A new store of the same type with the new mode.
189189
190190
Examples

src/zarr/api/asynchronous.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -396,12 +396,16 @@ async def save_array(
396396

397397
mode = kwargs.pop("mode", None)
398398
store_path = await make_store_path(store, path=path, mode=mode, storage_options=storage_options)
399+
if np.isscalar(arr):
400+
arr = np.array(arr)
401+
shape = arr.shape
402+
chunks = getattr(arr, "chunks", None) # for array-likes with chunks attribute
399403
new = await AsyncArray.create(
400404
store_path,
401405
zarr_format=zarr_format,
402-
shape=arr.shape,
406+
shape=shape,
403407
dtype=arr.dtype,
404-
chunks=arr.shape,
408+
chunks=chunks,
405409
**kwargs,
406410
)
407411
await new.setitem(slice(None), arr)
@@ -712,7 +716,7 @@ async def create(
712716
dtype: npt.DTypeLike | None = None,
713717
compressor: dict[str, JSON] | None = None, # TODO: default and type change
714718
fill_value: Any | None = 0, # TODO: need type
715-
order: MemoryOrder | None = None, # TODO: default change
719+
order: MemoryOrder | None = None,
716720
store: str | StoreLike | None = None,
717721
synchronizer: Any | None = None,
718722
overwrite: bool = False,
@@ -761,6 +765,7 @@ async def create(
761765
Default value to use for uninitialized portions of the array.
762766
order : {'C', 'F'}, optional
763767
Memory layout to be used within each chunk.
768+
Default is set in Zarr's config (`array.order`).
764769
store : Store or str
765770
Store or path to directory in file system or name of zip file.
766771
synchronizer : object, optional
@@ -834,12 +839,6 @@ async def create(
834839
else:
835840
chunk_shape = shape
836841

837-
if order is not None:
838-
warnings.warn(
839-
"order is deprecated, use config `array.order` instead",
840-
DeprecationWarning,
841-
stacklevel=2,
842-
)
843842
if synchronizer is not None:
844843
warnings.warn("synchronizer is not yet implemented", RuntimeWarning, stacklevel=2)
845844
if chunk_store is not None:
@@ -889,6 +888,7 @@ async def create(
889888
codecs=codecs,
890889
dimension_names=dimension_names,
891890
attributes=attributes,
891+
order=order,
892892
**kwargs,
893893
)
894894

0 commit comments

Comments
 (0)