dandi 0.78.0__tar.gz → 0.80.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dandi-0.78.0 → dandi-0.80.0}/CHANGELOG.md +47 -0
- {dandi-0.78.0/dandi.egg-info → dandi-0.80.0}/PKG-INFO +1 -1
- {dandi-0.78.0 → dandi-0.80.0}/dandi/_version.py +3 -3
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_download.py +13 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_ls.py +18 -1
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_upload.py +13 -1
- dandi-0.80.0/dandi/cli/tests/test_cmd_upload.py +51 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_download.py +7 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/dandiarchive.py +85 -6
- {dandi-0.78.0 → dandi-0.80.0}/dandi/download.py +100 -59
- {dandi-0.78.0 → dandi-0.80.0}/dandi/files/zarr.py +95 -28
- {dandi-0.78.0 → dandi-0.80.0}/dandi/metadata/util.py +2 -2
- {dandi-0.78.0 → dandi-0.80.0}/dandi/organize.py +50 -9
- {dandi-0.78.0 → dandi-0.80.0}/dandi/pynwb_utils.py +46 -3
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/dandiarchive-docker/docker-compose.yml +5 -1
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/fixtures.py +6 -3
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_dandiarchive.py +54 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_download.py +125 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_organize.py +108 -0
- dandi-0.80.0/dandi/tests/test_pynwb_utils.py +230 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_upload.py +253 -0
- dandi-0.80.0/dandi/tests/test_zarr_filter.py +228 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/upload.py +29 -3
- dandi-0.80.0/dandi/zarr_filter.py +167 -0
- {dandi-0.78.0 → dandi-0.80.0/dandi.egg-info}/PKG-INFO +1 -1
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/SOURCES.txt +2 -0
- dandi-0.78.0/dandi/cli/tests/test_cmd_upload.py +0 -22
- dandi-0.78.0/dandi/tests/test_pynwb_utils.py +0 -105
- {dandi-0.78.0 → dandi-0.80.0}/LICENSE +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/MANIFEST.in +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/README.md +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/bids_validator_deno/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/bids_validator_deno/_models.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/bids_validator_deno/_validator.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/base.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_delete.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_digest.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_instances.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_move.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_organize.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_service_scripts.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_shell_completion.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/cmd_validate.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/command.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/formatter.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.vcr.yaml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/elife.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/elife.vcr.yaml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.vcr.yaml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/nature.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/nature.vcr.yaml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/data/update_dandiset_from_doi/neuron.vcr.yaml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_base.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_cmd_ls.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_cmd_validate.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_command.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_digest.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_formatter.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_instances.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_move.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_service_scripts.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/cli/tests/test_shell_completion.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/consts.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/dandiapi.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/dandiset.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/delete.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/due.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/exceptions.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/files/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/files/_private.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/files/bases.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/files/bids.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/keyring_utils.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/metadata/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/metadata/core.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/metadata/nwb.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/misctypes.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/move.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/pytest_plugin.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/digests.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/iterators.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/pyout.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/tests/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/tests/test_digests.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/tests/test_iterators.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/support/threaded_walk.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/metadata/dandimeta_migration.new.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/metadata/metadata2asset.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/metadata/metadata2asset_3.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/metadata/metadata2asset_cellline.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/metadata/metadata2asset_simple1.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/0/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/0/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/1/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/1/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/bar/z/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/bar/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/bar1/z1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/bar1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/bar/z/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/bar/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/bar1/z1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/bar1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/0/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/0/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/1/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/1/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/0/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/0/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/1/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/1/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/bar/z/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/bar/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/bar1/z1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/bar1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/0/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/0/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/1/0 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/1/1 +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/zarr.json +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/skip.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_bids_validator_deno/test_validator.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_dandiapi.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_dandiset.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_delete.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_files.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_fixtures.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_helpers.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_helptext.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_keyring.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_metadata.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_move.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/test_utils.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/tests/xfail.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/utils.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/_core.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/_io.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/_types.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/tests/__init__.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/tests/test_core.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/tests/test_io.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi/validate/tests/test_types.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/dependency_links.txt +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/entry_points.txt +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/not-zip-safe +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/requires.txt +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/dandi.egg-info/top_level.txt +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/pyproject.toml +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/setup.cfg +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/setup.py +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/tox.ini +0 -0
- {dandi-0.78.0 → dandi-0.80.0}/versioneer.py +0 -0
|
@@ -1,3 +1,50 @@
|
|
|
1
|
+
# 0.80.0 (Thu Sep 17 2026)
|
|
2
|
+
|
|
3
|
+
#### 🚀 Enhancement
|
|
4
|
+
|
|
5
|
+
- Add support for partial Zarr download and upload [#1816](https://github.com/dandi/dandi-cli/pull/1816) ([@yarikoptic](https://github.com/yarikoptic) [@CodyCBakerPhD](https://github.com/CodyCBakerPhD) [@claude](https://github.com/claude))
|
|
6
|
+
|
|
7
|
+
#### 🏠 Internal
|
|
8
|
+
|
|
9
|
+
- Document import placement and walrus operator conventions [#1923](https://github.com/dandi/dandi-cli/pull/1923) (bdichter@Benjamins-Mac-mini.local [@bendichter](https://github.com/bendichter))
|
|
10
|
+
|
|
11
|
+
#### Authors: 5
|
|
12
|
+
|
|
13
|
+
- Ben Dichter ([@bendichter](https://github.com/bendichter))
|
|
14
|
+
- Benjamin Dichter (bdichter@Benjamins-Mac-mini.local)
|
|
15
|
+
- Claude ([@claude](https://github.com/claude))
|
|
16
|
+
- Cody Baker ([@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
|
|
17
|
+
- Yaroslav Halchenko ([@yarikoptic](https://github.com/yarikoptic))
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
# 0.79.0 (Mon Sep 14 2026)
|
|
22
|
+
|
|
23
|
+
#### 🚀 Enhancement
|
|
24
|
+
|
|
25
|
+
- Preserve legacy ndx-pose video references during organize [#1916](https://github.com/dandi/dandi-cli/pull/1916) ([@AtomicGlance](https://github.com/AtomicGlance))
|
|
26
|
+
|
|
27
|
+
#### 🐛 Bug Fix
|
|
28
|
+
|
|
29
|
+
- Say why metadata failed to load and how to see the tracebacks [#1901](https://github.com/dandi/dandi-cli/pull/1901) ([@adityasingh2400](https://github.com/adityasingh2400) [@yarikoptic](https://github.com/yarikoptic))
|
|
30
|
+
- Match media file extensions case-insensitively [#1911](https://github.com/dandi/dandi-cli/pull/1911) ([@h-mayorquin](https://github.com/h-mayorquin) [@CodyCBakerPhD](https://github.com/CodyCBakerPhD) [@yarikoptic](https://github.com/yarikoptic))
|
|
31
|
+
|
|
32
|
+
#### 🧪 Tests
|
|
33
|
+
|
|
34
|
+
- Pull MinIO from Quay: `minio/minio` was deleted from Docker Hub [#1921](https://github.com/dandi/dandi-cli/pull/1921) ([@AtomicGlance](https://github.com/AtomicGlance) [@yarikoptic](https://github.com/yarikoptic) [@yarikoptic-gitmate](https://github.com/yarikoptic-gitmate))
|
|
35
|
+
- Fix two recurring CI failures in daily scheduled runs [#1914](https://github.com/dandi/dandi-cli/pull/1914) ([@yarikoptic](https://github.com/yarikoptic))
|
|
36
|
+
|
|
37
|
+
#### Authors: 6
|
|
38
|
+
|
|
39
|
+
- Aditya Singh ([@adityasingh2400](https://github.com/adityasingh2400))
|
|
40
|
+
- Amirali Moradniaei ([@AtomicGlance](https://github.com/AtomicGlance))
|
|
41
|
+
- Cody Baker ([@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
|
|
42
|
+
- GitMate for @yarikoptic ([@yarikoptic-gitmate](https://github.com/yarikoptic-gitmate))
|
|
43
|
+
- Heberto Mayorquin ([@h-mayorquin](https://github.com/h-mayorquin))
|
|
44
|
+
- Yaroslav Halchenko ([@yarikoptic](https://github.com/yarikoptic))
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
1
48
|
# 0.78.0 (Fri Aug 28 2026)
|
|
2
49
|
|
|
3
50
|
#### 🚀 Enhancement
|
|
@@ -8,11 +8,11 @@ import json
|
|
|
8
8
|
|
|
9
9
|
version_json = '''
|
|
10
10
|
{
|
|
11
|
-
"date": "2026-
|
|
11
|
+
"date": "2026-09-17T13:44:48+0000",
|
|
12
12
|
"dirty": false,
|
|
13
13
|
"error": null,
|
|
14
|
-
"full-revisionid": "
|
|
15
|
-
"version": "0.
|
|
14
|
+
"full-revisionid": "f7cb5484e65c10c3c042f6985d85c7436d4de0ca",
|
|
15
|
+
"version": "0.80.0"
|
|
16
16
|
}
|
|
17
17
|
''' # END VERSION_JSON
|
|
18
18
|
|
|
@@ -132,6 +132,17 @@ Download files or entire folders from DANDI.
|
|
|
132
132
|
"With 'ask' (the default when --sync is passed without a value), prompt before "
|
|
133
133
|
"deleting. With 'do', delete without prompting.",
|
|
134
134
|
)
|
|
135
|
+
@click.option(
|
|
136
|
+
"--zarr",
|
|
137
|
+
"zarr_filters",
|
|
138
|
+
multiple=True,
|
|
139
|
+
metavar="FILTER",
|
|
140
|
+
help=(
|
|
141
|
+
"Filter entries within Zarr assets. Format: TYPE:PATTERN where TYPE "
|
|
142
|
+
"is 'glob', 'path', or 'regex'. Predefined: 'metadata'. "
|
|
143
|
+
"Can be specified multiple times (OR logic)."
|
|
144
|
+
),
|
|
145
|
+
)
|
|
135
146
|
@instance_option(
|
|
136
147
|
default=None,
|
|
137
148
|
help=(
|
|
@@ -165,6 +176,7 @@ def download(
|
|
|
165
176
|
format: DownloadFormat,
|
|
166
177
|
download_types: set[str],
|
|
167
178
|
sync: str | None,
|
|
179
|
+
zarr_filters: tuple[str, ...],
|
|
168
180
|
dandi_instance: str,
|
|
169
181
|
path_type: PathType,
|
|
170
182
|
preserve_tree: bool,
|
|
@@ -205,6 +217,7 @@ def download(
|
|
|
205
217
|
get_assets="assets" in download_types or preserve_tree,
|
|
206
218
|
preserve_tree=preserve_tree,
|
|
207
219
|
sync=SyncMode(sync) if sync is not None else None,
|
|
220
|
+
zarr_filters=zarr_filters,
|
|
208
221
|
path_type=path_type,
|
|
209
222
|
# develop_debug=develop_debug
|
|
210
223
|
)
|
|
@@ -8,7 +8,13 @@ from dandischema import models
|
|
|
8
8
|
from .base import devel_option, lgr, map_to_click_exceptions
|
|
9
9
|
from .formatter import JSONFormatter, JSONLinesFormatter, PYOUTFormatter, YAMLFormatter
|
|
10
10
|
from ..consts import ZARR_EXTENSIONS, metadata_all_fields
|
|
11
|
-
from ..
|
|
11
|
+
from ..dandiapi import BaseRemoteZarrAsset
|
|
12
|
+
from ..dandiarchive import (
|
|
13
|
+
AssetZarrEntryURL,
|
|
14
|
+
DandisetURL,
|
|
15
|
+
_dandi_url_parser,
|
|
16
|
+
parse_dandi_url,
|
|
17
|
+
)
|
|
12
18
|
from ..dandiset import Dandiset
|
|
13
19
|
from ..misctypes import Digest
|
|
14
20
|
from ..support.pyout import PYOUT_SHORT_NAMES, PYOUT_SHORT_NAMES_rev
|
|
@@ -143,6 +149,17 @@ def ls(
|
|
|
143
149
|
if metadata in ("all", "assets"):
|
|
144
150
|
rec["metadata"] = a.get_raw_metadata()
|
|
145
151
|
yield rec
|
|
152
|
+
# If URL points into a zarr, also list entries
|
|
153
|
+
if isinstance(parsed_url, AssetZarrEntryURL) and isinstance(
|
|
154
|
+
a, BaseRemoteZarrAsset
|
|
155
|
+
):
|
|
156
|
+
for entry in a.iterfiles(
|
|
157
|
+
prefix=parsed_url.zarr_subpath
|
|
158
|
+
):
|
|
159
|
+
yield {
|
|
160
|
+
"path": f"{a.path}/{entry}",
|
|
161
|
+
"size": entry.size,
|
|
162
|
+
}
|
|
146
163
|
else:
|
|
147
164
|
# For now we support only individual files
|
|
148
165
|
yield path
|
|
@@ -12,7 +12,7 @@ from .base import (
|
|
|
12
12
|
)
|
|
13
13
|
from ..consts import SyncMode
|
|
14
14
|
from ..exceptions import UploadValidationError
|
|
15
|
-
from ..upload import UploadExisting, UploadValidation
|
|
15
|
+
from ..upload import UploadExisting, UploadValidation, ZarrMode
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
@click.command()
|
|
@@ -58,6 +58,16 @@ from ..upload import UploadExisting, UploadValidation
|
|
|
58
58
|
default="require",
|
|
59
59
|
show_default=True,
|
|
60
60
|
)
|
|
61
|
+
@click.option(
|
|
62
|
+
"--zarr-mode",
|
|
63
|
+
type=EnumChoice(ZarrMode),
|
|
64
|
+
default="full",
|
|
65
|
+
help=(
|
|
66
|
+
"Zarr sync mode: 'full' (default) syncs completely; "
|
|
67
|
+
"'patch' uploads/updates without deleting remote files."
|
|
68
|
+
),
|
|
69
|
+
show_default=True,
|
|
70
|
+
)
|
|
61
71
|
@click.argument("paths", nargs=-1) # , type=click.Path(exists=True, dir_okay=False))
|
|
62
72
|
# &
|
|
63
73
|
# Development options: Set DANDI_DEVEL for them to become available
|
|
@@ -85,6 +95,7 @@ def upload(
|
|
|
85
95
|
dandi_instance: str,
|
|
86
96
|
existing: UploadExisting,
|
|
87
97
|
validation: UploadValidation,
|
|
98
|
+
zarr_mode: ZarrMode,
|
|
88
99
|
# Development options should come as kwargs
|
|
89
100
|
allow_any_path: bool = False,
|
|
90
101
|
upload_dandiset_metadata: bool = False,
|
|
@@ -132,6 +143,7 @@ def upload(
|
|
|
132
143
|
jobs=jobs,
|
|
133
144
|
jobs_per_file=jobs_per_file,
|
|
134
145
|
sync=SyncMode(sync) if sync is not None else None,
|
|
146
|
+
zarr_mode=zarr_mode,
|
|
135
147
|
validation_log_path=companion,
|
|
136
148
|
)
|
|
137
149
|
except UploadValidationError as exc:
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
from click.testing import CliRunner
|
|
2
|
+
import pytest
|
|
3
|
+
from pytest_mock import MockerFixture
|
|
4
|
+
|
|
5
|
+
from ..base import map_to_click_exceptions
|
|
6
|
+
from ..cmd_upload import upload
|
|
7
|
+
from ...exceptions import UploadValidationError
|
|
8
|
+
from ...upload import ZarrMode
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@pytest.mark.ai_generated
|
|
12
|
+
def test_upload_validation_error_has_no_traceback(mocker: MockerFixture) -> None:
|
|
13
|
+
mocker.patch.object(map_to_click_exceptions, "_do_map", False)
|
|
14
|
+
mocker.patch(
|
|
15
|
+
"dandi.upload.upload",
|
|
16
|
+
side_effect=UploadValidationError("failed validation"),
|
|
17
|
+
)
|
|
18
|
+
|
|
19
|
+
result = CliRunner().invoke(upload)
|
|
20
|
+
|
|
21
|
+
assert result.exit_code == 1
|
|
22
|
+
assert result.output == "Error: failed validation\n"
|
|
23
|
+
assert "Traceback" not in result.output
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
@pytest.mark.ai_generated
|
|
27
|
+
@pytest.mark.parametrize(
|
|
28
|
+
"args,expected",
|
|
29
|
+
[
|
|
30
|
+
([], ZarrMode.FULL),
|
|
31
|
+
(["--zarr-mode", "full"], ZarrMode.FULL),
|
|
32
|
+
(["--zarr-mode", "patch"], ZarrMode.PATCH),
|
|
33
|
+
],
|
|
34
|
+
)
|
|
35
|
+
def test_upload_zarr_mode_option(
|
|
36
|
+
mocker: MockerFixture, args: list[str], expected: ZarrMode
|
|
37
|
+
) -> None:
|
|
38
|
+
"""`--zarr-mode` takes the enum *values* and reaches `upload()`.
|
|
39
|
+
|
|
40
|
+
Regression test: with ``click >= 8.2`` a plain ``click.Choice`` over an
|
|
41
|
+
``Enum`` matches members on ``.name``, so the command line would have
|
|
42
|
+
required ``FULL``/``PATCH`` and even the ``full`` default would fail to
|
|
43
|
+
validate -- making *every* ``dandi upload`` invocation exit with a usage
|
|
44
|
+
error (exit code 2). ``EnumChoice`` matches on ``.value`` instead.
|
|
45
|
+
"""
|
|
46
|
+
upload_mock = mocker.patch("dandi.upload.upload")
|
|
47
|
+
|
|
48
|
+
result = CliRunner().invoke(upload, args)
|
|
49
|
+
|
|
50
|
+
assert result.exit_code == 0, result.output
|
|
51
|
+
assert upload_mock.call_args.kwargs["zarr_mode"] == expected
|
|
@@ -25,6 +25,7 @@ def test_download_defaults(mocker):
|
|
|
25
25
|
get_assets=True,
|
|
26
26
|
preserve_tree=False,
|
|
27
27
|
sync=None,
|
|
28
|
+
zarr_filters=(),
|
|
28
29
|
path_type=PathType.EXACT,
|
|
29
30
|
)
|
|
30
31
|
|
|
@@ -44,6 +45,7 @@ def test_download_all_types(mocker):
|
|
|
44
45
|
get_assets=True,
|
|
45
46
|
preserve_tree=False,
|
|
46
47
|
sync=None,
|
|
48
|
+
zarr_filters=(),
|
|
47
49
|
path_type=PathType.EXACT,
|
|
48
50
|
)
|
|
49
51
|
|
|
@@ -63,6 +65,7 @@ def test_download_metadata_only(mocker):
|
|
|
63
65
|
get_assets=False,
|
|
64
66
|
preserve_tree=False,
|
|
65
67
|
sync=None,
|
|
68
|
+
zarr_filters=(),
|
|
66
69
|
path_type=PathType.EXACT,
|
|
67
70
|
)
|
|
68
71
|
|
|
@@ -82,6 +85,7 @@ def test_download_assets_only(mocker):
|
|
|
82
85
|
get_assets=True,
|
|
83
86
|
preserve_tree=False,
|
|
84
87
|
sync=None,
|
|
88
|
+
zarr_filters=(),
|
|
85
89
|
path_type=PathType.EXACT,
|
|
86
90
|
)
|
|
87
91
|
|
|
@@ -117,6 +121,7 @@ def test_download_gui_instance_in_dandiset(mocker, tmp_path, monkeypatch):
|
|
|
117
121
|
get_assets=True,
|
|
118
122
|
preserve_tree=False,
|
|
119
123
|
sync=None,
|
|
124
|
+
zarr_filters=(),
|
|
120
125
|
path_type=PathType.EXACT,
|
|
121
126
|
)
|
|
122
127
|
|
|
@@ -144,6 +149,7 @@ def test_download_api_instance_in_dandiset(mocker, tmp_path, monkeypatch):
|
|
|
144
149
|
get_assets=True,
|
|
145
150
|
preserve_tree=False,
|
|
146
151
|
sync=None,
|
|
152
|
+
zarr_filters=(),
|
|
147
153
|
path_type=PathType.EXACT,
|
|
148
154
|
)
|
|
149
155
|
|
|
@@ -170,6 +176,7 @@ def test_download_url_instance_match(mocker):
|
|
|
170
176
|
get_assets=True,
|
|
171
177
|
preserve_tree=False,
|
|
172
178
|
sync=None,
|
|
179
|
+
zarr_filters=(),
|
|
173
180
|
path_type=PathType.EXACT,
|
|
174
181
|
)
|
|
175
182
|
|
|
@@ -47,6 +47,7 @@ from .consts import (
|
|
|
47
47
|
REDIRECT_HEAD_TIMEOUT,
|
|
48
48
|
RETRY_STATUSES,
|
|
49
49
|
VERSION_REGEX,
|
|
50
|
+
ZARR_EXTENSIONS,
|
|
50
51
|
DandiInstance,
|
|
51
52
|
known_instances,
|
|
52
53
|
)
|
|
@@ -446,6 +447,72 @@ class AssetItemURL(SingleAssetURL):
|
|
|
446
447
|
)
|
|
447
448
|
|
|
448
449
|
|
|
450
|
+
def split_zarr_location(location: str) -> tuple[str, str] | None:
|
|
451
|
+
"""Split a location into ``(asset_path, zarr_subpath)`` if it crosses a zarr boundary.
|
|
452
|
+
|
|
453
|
+
Scans path components for segments ending with a Zarr extension
|
|
454
|
+
(``.zarr``, ``.ngff``). If found **and** there are remaining components
|
|
455
|
+
after the boundary, returns the split; otherwise returns ``None``.
|
|
456
|
+
|
|
457
|
+
Parameters
|
|
458
|
+
----------
|
|
459
|
+
location : str
|
|
460
|
+
A POSIX-style path, e.g. ``"sub-1/file.ome.zarr/0/0/0"``.
|
|
461
|
+
|
|
462
|
+
Returns
|
|
463
|
+
-------
|
|
464
|
+
tuple[str, str] | None
|
|
465
|
+
``(asset_path, zarr_subpath)`` when a zarr boundary with a subpath
|
|
466
|
+
is detected, otherwise ``None``.
|
|
467
|
+
|
|
468
|
+
Examples
|
|
469
|
+
--------
|
|
470
|
+
>>> split_zarr_location("sub-1/file.ome.zarr/0/0/0")
|
|
471
|
+
('sub-1/file.ome.zarr', '0/0/0')
|
|
472
|
+
>>> split_zarr_location("sub-1/file.ome.zarr") # no subpath
|
|
473
|
+
>>> split_zarr_location("sub-1/file.nwb") # no zarr extension
|
|
474
|
+
"""
|
|
475
|
+
parts = [p for p in location.split("/") if p]
|
|
476
|
+
for i, part in enumerate(parts):
|
|
477
|
+
if any(part.endswith(ext) for ext in ZARR_EXTENSIONS):
|
|
478
|
+
asset_path = "/".join(parts[: i + 1])
|
|
479
|
+
zarr_subpath = "/".join(parts[i + 1 :])
|
|
480
|
+
return (asset_path, zarr_subpath) if zarr_subpath else None
|
|
481
|
+
return None
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
@dataclass
|
|
485
|
+
class AssetZarrEntryURL(SingleAssetURL):
|
|
486
|
+
"""Parsed from a URL that points into entries within a Zarr asset.
|
|
487
|
+
|
|
488
|
+
For example, ``dandi://dandi/000108/sub-1/file.ome.zarr/0/0/0`` would
|
|
489
|
+
produce ``asset_path="sub-1/file.ome.zarr"`` and ``zarr_subpath="0/0/0"``.
|
|
490
|
+
"""
|
|
491
|
+
|
|
492
|
+
asset_path: str # e.g., "sub-1/file.ome.zarr"
|
|
493
|
+
zarr_subpath: str # e.g., "0/0/0"
|
|
494
|
+
|
|
495
|
+
def get_assets(
|
|
496
|
+
self, client: DandiAPIClient, order: str | None = None, strict: bool = False
|
|
497
|
+
) -> Iterator[BaseRemoteAsset]:
|
|
498
|
+
"""Yield the zarr asset whose path equals ``asset_path``.
|
|
499
|
+
|
|
500
|
+
If the asset does not exist, a `NotFoundError` is raised when
|
|
501
|
+
``strict`` is true; otherwise nothing is yielded.
|
|
502
|
+
"""
|
|
503
|
+
try:
|
|
504
|
+
dandiset = self.get_dandiset(client, lazy=not strict)
|
|
505
|
+
assert dandiset is not None
|
|
506
|
+
dandiset.version_id # Force version evaluation
|
|
507
|
+
except NotFoundError:
|
|
508
|
+
if strict:
|
|
509
|
+
raise
|
|
510
|
+
else:
|
|
511
|
+
return
|
|
512
|
+
with _maybe_strict(strict):
|
|
513
|
+
yield dandiset.get_asset_by_path(self.asset_path)
|
|
514
|
+
|
|
515
|
+
|
|
449
516
|
@dataclass
|
|
450
517
|
class AssetFolderURL(MultiAssetURL):
|
|
451
518
|
"""
|
|
@@ -846,12 +913,24 @@ class _dandi_url_parser:
|
|
|
846
913
|
path=location,
|
|
847
914
|
)
|
|
848
915
|
else:
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
916
|
+
# Check if location crosses a zarr boundary
|
|
917
|
+
zarr_split = split_zarr_location(location)
|
|
918
|
+
if zarr_split is not None:
|
|
919
|
+
asset_path, zarr_subpath = zarr_split
|
|
920
|
+
parsed_url = AssetZarrEntryURL(
|
|
921
|
+
instance=instance,
|
|
922
|
+
dandiset_id=dandiset_id,
|
|
923
|
+
version_id=version_id,
|
|
924
|
+
asset_path=asset_path,
|
|
925
|
+
zarr_subpath=zarr_subpath,
|
|
926
|
+
)
|
|
927
|
+
else:
|
|
928
|
+
parsed_url = AssetItemURL(
|
|
929
|
+
instance=instance,
|
|
930
|
+
dandiset_id=dandiset_id,
|
|
931
|
+
version_id=version_id,
|
|
932
|
+
path=location,
|
|
933
|
+
)
|
|
855
934
|
elif asset_id:
|
|
856
935
|
if dandiset_id is None:
|
|
857
936
|
parsed_url = BaseAssetIDURL(instance=instance, asset_id=asset_id)
|
|
@@ -48,6 +48,7 @@ from .consts import (
|
|
|
48
48
|
from .dandiapi import AssetType, BaseRemoteZarrAsset, RemoteDandiset
|
|
49
49
|
from .dandiarchive import (
|
|
50
50
|
AssetItemURL,
|
|
51
|
+
AssetZarrEntryURL,
|
|
51
52
|
DandisetURL,
|
|
52
53
|
ParsedDandiURL,
|
|
53
54
|
SingleAssetURL,
|
|
@@ -71,6 +72,7 @@ from .utils import (
|
|
|
71
72
|
pluralize,
|
|
72
73
|
yaml_load,
|
|
73
74
|
)
|
|
75
|
+
from .zarr_filter import ZarrFilter, make_zarr_entry_filter, parse_zarr_filter
|
|
74
76
|
|
|
75
77
|
lgr = get_logger()
|
|
76
78
|
|
|
@@ -105,6 +107,7 @@ def download(
|
|
|
105
107
|
get_assets: bool = True,
|
|
106
108
|
preserve_tree: bool = False,
|
|
107
109
|
sync: bool | SyncMode | None = False,
|
|
110
|
+
zarr_filters: Sequence[str] = (),
|
|
108
111
|
path_type: PathType = PathType.EXACT,
|
|
109
112
|
) -> None:
|
|
110
113
|
# TODO: unduplicate with upload. For now stole from that one
|
|
@@ -119,6 +122,24 @@ def download(
|
|
|
119
122
|
|
|
120
123
|
parsed_urls = [parse_dandi_url(u, glob=path_type is PathType.GLOB) for u in urls]
|
|
121
124
|
|
|
125
|
+
# Parse zarr entry filters
|
|
126
|
+
zarr_entry_filter: Callable[[str], bool] | None = None
|
|
127
|
+
all_zf: list[ZarrFilter] = []
|
|
128
|
+
if zarr_filters:
|
|
129
|
+
for spec in zarr_filters:
|
|
130
|
+
all_zf.extend(parse_zarr_filter(spec))
|
|
131
|
+
|
|
132
|
+
# Merge URL-derived path filters from AssetZarrEntryURL
|
|
133
|
+
for purl in parsed_urls:
|
|
134
|
+
if isinstance(purl, AssetZarrEntryURL):
|
|
135
|
+
all_zf.append(ZarrFilter("path", purl.zarr_subpath))
|
|
136
|
+
|
|
137
|
+
if all_zf:
|
|
138
|
+
zarr_entry_filter = make_zarr_entry_filter(all_zf)
|
|
139
|
+
|
|
140
|
+
if sync and zarr_entry_filter is not None:
|
|
141
|
+
raise ValueError("--sync and --zarr cannot be used together")
|
|
142
|
+
|
|
122
143
|
# dandi.cli.formatters are used in cmd_ls to provide switchable
|
|
123
144
|
pyout_style = pyouts.get_style(hide_if_missing=False)
|
|
124
145
|
|
|
@@ -155,6 +176,7 @@ def download(
|
|
|
155
176
|
preserve_tree=preserve_tree,
|
|
156
177
|
jobs_per_zarr=jobs_per_zarr,
|
|
157
178
|
on_error="yield" if format is DownloadFormat.PYOUT else "raise",
|
|
179
|
+
zarr_entry_filter=zarr_entry_filter,
|
|
158
180
|
**kw,
|
|
159
181
|
)
|
|
160
182
|
for purl in parsed_urls
|
|
@@ -250,6 +272,7 @@ class Downloader:
|
|
|
250
272
|
preserve_tree: bool
|
|
251
273
|
jobs_per_zarr: int | None
|
|
252
274
|
on_error: Literal["raise", "yield"]
|
|
275
|
+
zarr_entry_filter: Callable[[str], bool] | None = None
|
|
253
276
|
#: which will be set .gen to assets. Purpose is to make it possible to get
|
|
254
277
|
#: summary statistics while already downloading. TODO: reimplement
|
|
255
278
|
#: properly!
|
|
@@ -374,6 +397,7 @@ class Downloader:
|
|
|
374
397
|
existing=self.existing,
|
|
375
398
|
jobs=self.jobs_per_zarr,
|
|
376
399
|
lock=lock,
|
|
400
|
+
zarr_entry_filter=self.zarr_entry_filter,
|
|
377
401
|
)
|
|
378
402
|
|
|
379
403
|
def _progress_filter(gen):
|
|
@@ -1016,14 +1040,15 @@ def _download_zarr(
|
|
|
1016
1040
|
existing: DownloadExisting,
|
|
1017
1041
|
lock: Lock,
|
|
1018
1042
|
jobs: int | None = None,
|
|
1043
|
+
zarr_entry_filter: Callable[[str], bool] | None = None,
|
|
1019
1044
|
) -> Iterator[dict]:
|
|
1020
1045
|
# Avoid heavy import by importing within function:
|
|
1021
1046
|
from .support.digests import get_zarr_checksum
|
|
1022
1047
|
|
|
1023
1048
|
# we will collect them all while starting the download
|
|
1024
1049
|
# with the first page of entries received from the server.
|
|
1025
|
-
entries = []
|
|
1026
|
-
digests = {}
|
|
1050
|
+
entries: list = []
|
|
1051
|
+
digests: dict[str, str] = {}
|
|
1027
1052
|
pc = ProgressCombiner(zarr_size=asset.size)
|
|
1028
1053
|
|
|
1029
1054
|
def digest_callback(path: str, algoname: str, d: str) -> None:
|
|
@@ -1032,21 +1057,24 @@ def _download_zarr(
|
|
|
1032
1057
|
|
|
1033
1058
|
def downloads_gen():
|
|
1034
1059
|
for entry in asset.iterfiles():
|
|
1060
|
+
entry_path = str(entry)
|
|
1061
|
+
if zarr_entry_filter is not None and not zarr_entry_filter(entry_path):
|
|
1062
|
+
continue
|
|
1035
1063
|
entries.append(entry)
|
|
1036
1064
|
etag = entry.digest
|
|
1037
1065
|
assert etag.algorithm is DigestType.md5
|
|
1038
1066
|
yield pairing(
|
|
1039
|
-
|
|
1067
|
+
entry_path,
|
|
1040
1068
|
_download_file(
|
|
1041
1069
|
entry.get_download_file_iter(),
|
|
1042
|
-
download_path /
|
|
1070
|
+
download_path / entry_path,
|
|
1043
1071
|
toplevel_path=toplevel_path,
|
|
1044
1072
|
size=entry.size,
|
|
1045
1073
|
mtime=entry.modified,
|
|
1046
1074
|
existing=existing,
|
|
1047
1075
|
digests={"md5": etag.value},
|
|
1048
1076
|
lock=lock,
|
|
1049
|
-
digest_callback=partial(digest_callback,
|
|
1077
|
+
digest_callback=partial(digest_callback, entry_path),
|
|
1050
1078
|
),
|
|
1051
1079
|
)
|
|
1052
1080
|
pc.file_qty = len(entries)
|
|
@@ -1066,64 +1094,77 @@ def _download_zarr(
|
|
|
1066
1094
|
if final_out is not None:
|
|
1067
1095
|
break
|
|
1068
1096
|
else:
|
|
1097
|
+
if zarr_entry_filter is not None:
|
|
1098
|
+
# Filter matched no entries; still report completion
|
|
1099
|
+
yield {"status": "done"}
|
|
1069
1100
|
return
|
|
1070
1101
|
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
p.unlink()
|
|
1093
|
-
except OSError:
|
|
1102
|
+
if zarr_entry_filter is not None:
|
|
1103
|
+
# Partial download: skip deleting extra local files and skip
|
|
1104
|
+
# whole-zarr checksum verification (individual file checksums
|
|
1105
|
+
# are still verified during download).
|
|
1106
|
+
lgr.debug(
|
|
1107
|
+
"%s: Partial download — skipping extra-file deletion and"
|
|
1108
|
+
" zarr checksum verification",
|
|
1109
|
+
download_path,
|
|
1110
|
+
)
|
|
1111
|
+
else:
|
|
1112
|
+
remote_paths = set(map(str, entries))
|
|
1113
|
+
zarr_basepath = Path(download_path)
|
|
1114
|
+
|
|
1115
|
+
announced: bool = False
|
|
1116
|
+
empty_dirs: deque[Path] = deque()
|
|
1117
|
+
dirs: deque[Path] = deque([zarr_basepath])
|
|
1118
|
+
while dirs:
|
|
1119
|
+
d = dirs.popleft()
|
|
1120
|
+
is_empty = True
|
|
1121
|
+
for p in list(d.iterdir()):
|
|
1122
|
+
if exclude_from_zarr(p):
|
|
1094
1123
|
is_empty = False
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1124
|
+
elif (
|
|
1125
|
+
p.is_file()
|
|
1126
|
+
and p.relative_to(zarr_basepath).as_posix() not in remote_paths
|
|
1127
|
+
):
|
|
1128
|
+
if not announced:
|
|
1129
|
+
announced = True
|
|
1130
|
+
yield {"status": "deleting extra files"}
|
|
1131
|
+
try:
|
|
1132
|
+
lgr.debug("Deleting extra Zarr file %s", p)
|
|
1133
|
+
p.unlink()
|
|
1134
|
+
except OSError:
|
|
1135
|
+
is_empty = False
|
|
1136
|
+
elif p.is_dir():
|
|
1137
|
+
dirs.append(p)
|
|
1138
|
+
is_empty = False
|
|
1139
|
+
else:
|
|
1140
|
+
is_empty = False
|
|
1141
|
+
if is_empty and d != zarr_basepath:
|
|
1142
|
+
empty_dirs.append(d)
|
|
1143
|
+
while empty_dirs:
|
|
1144
|
+
d = empty_dirs.popleft()
|
|
1145
|
+
if not announced:
|
|
1146
|
+
announced = True
|
|
1147
|
+
yield {"status": "deleting extra files"}
|
|
1148
|
+
lgr.debug("Removing now-empty Zarr directory %s", d)
|
|
1149
|
+
d.rmdir()
|
|
1150
|
+
if d.parent != zarr_basepath and not any(d.parent.iterdir()):
|
|
1151
|
+
empty_dirs.append(d.parent)
|
|
1152
|
+
|
|
1153
|
+
if "skipped" not in final_out["message"]:
|
|
1154
|
+
zarr_checksum = asset.get_digest().value
|
|
1155
|
+
local_checksum = get_zarr_checksum(zarr_basepath, known=digests)
|
|
1156
|
+
if zarr_checksum != local_checksum:
|
|
1157
|
+
msg = f"Zarr checksum: downloaded {local_checksum} != {zarr_checksum}"
|
|
1158
|
+
yield {"checksum": "differs", "status": "error", "message": msg}
|
|
1159
|
+
lgr.debug("%s is different: %s.", zarr_basepath, msg)
|
|
1160
|
+
return
|
|
1098
1161
|
else:
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
announced = True
|
|
1106
|
-
yield {"status": "deleting extra files"}
|
|
1107
|
-
lgr.debug("Removing now-empty Zarr directory %s", d)
|
|
1108
|
-
d.rmdir()
|
|
1109
|
-
if d.parent != zarr_basepath and not any(d.parent.iterdir()):
|
|
1110
|
-
empty_dirs.append(d.parent)
|
|
1111
|
-
|
|
1112
|
-
if "skipped" not in final_out["message"]:
|
|
1113
|
-
zarr_checksum = asset.get_digest().value
|
|
1114
|
-
local_checksum = get_zarr_checksum(zarr_basepath, known=digests)
|
|
1115
|
-
if zarr_checksum != local_checksum:
|
|
1116
|
-
msg = f"Zarr checksum: downloaded {local_checksum} != {zarr_checksum}"
|
|
1117
|
-
yield {"checksum": "differs", "status": "error", "message": msg}
|
|
1118
|
-
lgr.debug("%s is different: %s.", zarr_basepath, msg)
|
|
1119
|
-
return
|
|
1120
|
-
else:
|
|
1121
|
-
yield {"checksum": "ok"}
|
|
1122
|
-
lgr.debug(
|
|
1123
|
-
"Verified that %s has correct Zarr checksum %s",
|
|
1124
|
-
zarr_basepath,
|
|
1125
|
-
zarr_checksum,
|
|
1126
|
-
)
|
|
1162
|
+
yield {"checksum": "ok"}
|
|
1163
|
+
lgr.debug(
|
|
1164
|
+
"Verified that %s has correct Zarr checksum %s",
|
|
1165
|
+
zarr_basepath,
|
|
1166
|
+
zarr_checksum,
|
|
1167
|
+
)
|
|
1127
1168
|
|
|
1128
1169
|
yield {"status": "done"}
|
|
1129
1170
|
|