dandi 0.77.0__tar.gz → 0.78.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.
Files changed (168) hide show
  1. {dandi-0.77.0 → dandi-0.78.0}/CHANGELOG.md +21 -0
  2. {dandi-0.77.0/dandi.egg-info → dandi-0.78.0}/PKG-INFO +1 -1
  3. {dandi-0.77.0 → dandi-0.78.0}/dandi/_version.py +3 -3
  4. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_organize.py +4 -4
  5. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_shell_completion.py +1 -6
  6. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_upload.py +17 -13
  7. dandi-0.78.0/dandi/cli/tests/test_cmd_upload.py +22 -0
  8. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_command.py +3 -2
  9. dandi-0.78.0/dandi/cli/tests/test_digest.py +108 -0
  10. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_download.py +6 -4
  11. {dandi-0.77.0 → dandi-0.78.0}/dandi/consts.py +13 -0
  12. {dandi-0.77.0 → dandi-0.78.0}/dandi/download.py +30 -4
  13. {dandi-0.77.0 → dandi-0.78.0}/dandi/exceptions.py +6 -0
  14. {dandi-0.77.0 → dandi-0.78.0}/dandi/files/__init__.py +2 -0
  15. {dandi-0.77.0 → dandi-0.78.0}/dandi/files/_private.py +7 -1
  16. {dandi-0.77.0 → dandi-0.78.0}/dandi/files/bases.py +6 -0
  17. {dandi-0.77.0 → dandi-0.78.0}/dandi/organize.py +1 -1
  18. {dandi-0.77.0 → dandi-0.78.0}/dandi/pynwb_utils.py +131 -25
  19. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/fixtures.py +81 -0
  20. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_download.py +149 -2
  21. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_files.py +11 -0
  22. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_organize.py +68 -0
  23. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_upload.py +14 -2
  24. {dandi-0.77.0 → dandi-0.78.0}/dandi/upload.py +14 -9
  25. {dandi-0.77.0 → dandi-0.78.0/dandi.egg-info}/PKG-INFO +1 -1
  26. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/SOURCES.txt +1 -0
  27. dandi-0.77.0/dandi/cli/tests/test_digest.py +0 -104
  28. {dandi-0.77.0 → dandi-0.78.0}/LICENSE +0 -0
  29. {dandi-0.77.0 → dandi-0.78.0}/MANIFEST.in +0 -0
  30. {dandi-0.77.0 → dandi-0.78.0}/README.md +0 -0
  31. {dandi-0.77.0 → dandi-0.78.0}/dandi/__init__.py +0 -0
  32. {dandi-0.77.0 → dandi-0.78.0}/dandi/bids_validator_deno/__init__.py +0 -0
  33. {dandi-0.77.0 → dandi-0.78.0}/dandi/bids_validator_deno/_models.py +0 -0
  34. {dandi-0.77.0 → dandi-0.78.0}/dandi/bids_validator_deno/_validator.py +0 -0
  35. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/__init__.py +0 -0
  36. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/base.py +0 -0
  37. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_delete.py +0 -0
  38. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_digest.py +0 -0
  39. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_download.py +0 -0
  40. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_instances.py +0 -0
  41. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_ls.py +0 -0
  42. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_move.py +0 -0
  43. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_service_scripts.py +0 -0
  44. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/cmd_validate.py +0 -0
  45. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/command.py +0 -0
  46. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/formatter.py +0 -0
  47. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/__init__.py +0 -0
  48. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.json +0 -0
  49. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/biorxiv.vcr.yaml +0 -0
  50. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/elife.json +0 -0
  51. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/elife.vcr.yaml +0 -0
  52. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.json +0 -0
  53. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/jneurosci.vcr.yaml +0 -0
  54. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/nature.json +0 -0
  55. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/nature.vcr.yaml +0 -0
  56. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/neuron.json +0 -0
  57. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/data/update_dandiset_from_doi/neuron.vcr.yaml +0 -0
  58. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_base.py +0 -0
  59. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_cmd_ls.py +0 -0
  60. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_cmd_validate.py +0 -0
  61. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_formatter.py +0 -0
  62. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_instances.py +0 -0
  63. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_move.py +0 -0
  64. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_service_scripts.py +0 -0
  65. {dandi-0.77.0 → dandi-0.78.0}/dandi/cli/tests/test_shell_completion.py +0 -0
  66. {dandi-0.77.0 → dandi-0.78.0}/dandi/dandiapi.py +0 -0
  67. {dandi-0.77.0 → dandi-0.78.0}/dandi/dandiarchive.py +0 -0
  68. {dandi-0.77.0 → dandi-0.78.0}/dandi/dandiset.py +0 -0
  69. {dandi-0.77.0 → dandi-0.78.0}/dandi/delete.py +0 -0
  70. {dandi-0.77.0 → dandi-0.78.0}/dandi/due.py +0 -0
  71. {dandi-0.77.0 → dandi-0.78.0}/dandi/files/bids.py +0 -0
  72. {dandi-0.77.0 → dandi-0.78.0}/dandi/files/zarr.py +0 -0
  73. {dandi-0.77.0 → dandi-0.78.0}/dandi/keyring_utils.py +0 -0
  74. {dandi-0.77.0 → dandi-0.78.0}/dandi/metadata/__init__.py +0 -0
  75. {dandi-0.77.0 → dandi-0.78.0}/dandi/metadata/core.py +0 -0
  76. {dandi-0.77.0 → dandi-0.78.0}/dandi/metadata/nwb.py +0 -0
  77. {dandi-0.77.0 → dandi-0.78.0}/dandi/metadata/util.py +0 -0
  78. {dandi-0.77.0 → dandi-0.78.0}/dandi/misctypes.py +0 -0
  79. {dandi-0.77.0 → dandi-0.78.0}/dandi/move.py +0 -0
  80. {dandi-0.77.0 → dandi-0.78.0}/dandi/pytest_plugin.py +0 -0
  81. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/__init__.py +0 -0
  82. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/digests.py +0 -0
  83. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/iterators.py +0 -0
  84. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/pyout.py +0 -0
  85. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/tests/__init__.py +0 -0
  86. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/tests/test_digests.py +0 -0
  87. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/tests/test_iterators.py +0 -0
  88. {dandi-0.77.0 → dandi-0.78.0}/dandi/support/threaded_walk.py +0 -0
  89. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/__init__.py +0 -0
  90. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/dandiarchive-docker/docker-compose.yml +0 -0
  91. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/metadata/dandimeta_migration.new.json +0 -0
  92. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/metadata/metadata2asset.json +0 -0
  93. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/metadata/metadata2asset_3.json +0 -0
  94. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/metadata/metadata2asset_cellline.json +0 -0
  95. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/metadata/metadata2asset_simple1.json +0 -0
  96. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/0/0 +0 -0
  97. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/0/1 +0 -0
  98. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/1/0 +0 -0
  99. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/c/1/1 +0 -0
  100. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/array_v3_corrupt_zarr_json.zarr/zarr.json +0 -0
  101. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/bar/z/zarr.json +0 -0
  102. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/bar/zarr.json +0 -0
  103. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo/zarr.json +0 -0
  104. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/bar1/z1/zarr.json +0 -0
  105. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/bar1/zarr.json +0 -0
  106. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_missing_zarr_json.zarr/foo1/zarr.json +0 -0
  107. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/bar/z/zarr.json +0 -0
  108. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/bar/zarr.json +0 -0
  109. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo/zarr.json +0 -0
  110. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/bar1/z1/zarr.json +0 -0
  111. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/bar1/zarr.json +0 -0
  112. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/foo1/zarr.json +0 -0
  113. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/arrays_in_groups_node_type_problem.zarr/zarr.json +0 -0
  114. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/0/0 +0 -0
  115. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/0/1 +0 -0
  116. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/1/0 +0 -0
  117. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_missing_zarr_json.zarr/c/1/1 +0 -0
  118. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/0/0 +0 -0
  119. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/0/1 +0 -0
  120. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/1/0 +0 -0
  121. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/c/1/1 +0 -0
  122. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/invalid_stores/single_array_node_type_problem.zarr/zarr.json +0 -0
  123. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/bar/z/zarr.json +0 -0
  124. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/bar/zarr.json +0 -0
  125. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo/zarr.json +0 -0
  126. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/bar1/z1/zarr.json +0 -0
  127. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/bar1/zarr.json +0 -0
  128. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/foo1/zarr.json +0 -0
  129. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/arrays_in_groups.zarr/zarr.json +0 -0
  130. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/0/0 +0 -0
  131. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/0/1 +0 -0
  132. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/1/0 +0 -0
  133. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/c/1/1 +0 -0
  134. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/data/zarr3_stores/valid_stores/single_array.zarr/zarr.json +0 -0
  135. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/skip.py +0 -0
  136. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_bids_validator_deno/test_validator.py +0 -0
  137. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_dandiapi.py +0 -0
  138. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_dandiarchive.py +0 -0
  139. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_dandiset.py +0 -0
  140. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_delete.py +0 -0
  141. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_fixtures.py +0 -0
  142. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_helpers.py +0 -0
  143. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_helptext.py +0 -0
  144. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_keyring.py +0 -0
  145. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_metadata.py +0 -0
  146. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_move.py +0 -0
  147. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_pynwb_utils.py +0 -0
  148. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/test_utils.py +0 -0
  149. {dandi-0.77.0 → dandi-0.78.0}/dandi/tests/xfail.py +0 -0
  150. {dandi-0.77.0 → dandi-0.78.0}/dandi/utils.py +0 -0
  151. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/__init__.py +0 -0
  152. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/_core.py +0 -0
  153. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/_io.py +0 -0
  154. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/_types.py +0 -0
  155. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/tests/__init__.py +0 -0
  156. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/tests/test_core.py +0 -0
  157. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/tests/test_io.py +0 -0
  158. {dandi-0.77.0 → dandi-0.78.0}/dandi/validate/tests/test_types.py +0 -0
  159. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/dependency_links.txt +0 -0
  160. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/entry_points.txt +0 -0
  161. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/not-zip-safe +0 -0
  162. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/requires.txt +0 -0
  163. {dandi-0.77.0 → dandi-0.78.0}/dandi.egg-info/top_level.txt +0 -0
  164. {dandi-0.77.0 → dandi-0.78.0}/pyproject.toml +0 -0
  165. {dandi-0.77.0 → dandi-0.78.0}/setup.cfg +0 -0
  166. {dandi-0.77.0 → dandi-0.78.0}/setup.py +0 -0
  167. {dandi-0.77.0 → dandi-0.78.0}/tox.ini +0 -0
  168. {dandi-0.77.0 → dandi-0.78.0}/versioneer.py +0 -0
@@ -1,3 +1,24 @@
1
+ # 0.78.0 (Fri Aug 28 2026)
2
+
3
+ #### 🚀 Enhancement
4
+
5
+ - Organize and upload images referenced by NWB files with `ExternalImage` [#1905](https://github.com/dandi/dandi-cli/pull/1905) ([@h-mayorquin](https://github.com/h-mayorquin) [@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
6
+
7
+ #### 🐛 Bug Fix
8
+
9
+ - Tolerate the filesystem's mtime granularity in `download -e refresh` [#1910](https://github.com/dandi/dandi-cli/pull/1910) ([@claude](https://github.com/claude) [@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
10
+ - Stop using deprecated Click test/version APIs [#1906](https://github.com/dandi/dandi-cli/pull/1906) ([@claude](https://github.com/claude) [@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
11
+ - Point failed uploads to validation report [#1896](https://github.com/dandi/dandi-cli/pull/1896) ([@AtomicGlance](https://github.com/AtomicGlance))
12
+
13
+ #### Authors: 4
14
+
15
+ - Amirali Moradniaei ([@AtomicGlance](https://github.com/AtomicGlance))
16
+ - Claude ([@claude](https://github.com/claude))
17
+ - Cody Baker ([@CodyCBakerPhD](https://github.com/CodyCBakerPhD))
18
+ - Heberto Mayorquin ([@h-mayorquin](https://github.com/h-mayorquin))
19
+
20
+ ---
21
+
1
22
  # 0.77.0 (Sat Aug 08 2026)
2
23
 
3
24
  #### 🚀 Enhancement
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dandi
3
- Version: 0.77.0
3
+ Version: 0.78.0
4
4
  Summary: Command line client for interaction with DANDI instances
5
5
  Author-email: DANDI developers <team@dandiarchive.org>
6
6
  Maintainer-email: DANDI developers <team@dandiarchive.org>
@@ -8,11 +8,11 @@ import json
8
8
 
9
9
  version_json = '''
10
10
  {
11
- "date": "2026-08-08T01:08:07+0000",
11
+ "date": "2026-08-28T19:39:02+0000",
12
12
  "dirty": false,
13
13
  "error": null,
14
- "full-revisionid": "e982b3bc3c34a8ec3b7c6949a671cbe10fd0a296",
15
- "version": "0.77.0"
14
+ "full-revisionid": "945086c6f24671bf7131eb7134d7aac7efddc714",
15
+ "version": "0.78.0"
16
16
  }
17
17
  ''' # END VERSION_JSON
18
18
 
@@ -43,16 +43,16 @@ from ..organize import CopyMode, FileOperationMode, OrganizeInvalid
43
43
  "--update-external-file-paths",
44
44
  is_flag=True,
45
45
  default=False,
46
- help="Rewrite the 'external_file' arguments of ImageSeries in NWB files. "
47
- "The new values will correspond to the new locations of the video files "
48
- "after being organized. "
46
+ help="Rewrite the 'external_file' arguments of ImageSeries and the 'data' of "
47
+ "ExternalImage in NWB files. The new values will correspond to the new locations "
48
+ "of the referenced media files after being organized. "
49
49
  "This option requires --files-mode to be 'copy' or 'move'",
50
50
  )
51
51
  @click.option(
52
52
  "--media-files-mode",
53
53
  type=EnumChoice(CopyMode),
54
54
  default=None,
55
- help="How to relocate video files referenced by NWB files",
55
+ help="How to relocate media files referenced by NWB files",
56
56
  )
57
57
  @click.option(
58
58
  "--required-field",
@@ -2,7 +2,6 @@ import os
2
2
  from os.path import basename, normcase, splitext
3
3
 
4
4
  import click
5
- from packaging.version import Version
6
5
 
7
6
  SHELLS = ["bash", "zsh", "fish"]
8
7
 
@@ -42,11 +41,7 @@ def shell_completion(shell):
42
41
  shell = stem
43
42
  if shell not in SHELLS:
44
43
  raise click.UsageError(f"Unsupported/unrecognized shell {shell!r}")
45
- if Version(click.__version__) < Version("8.0.0"):
46
- varfmt = "source_{shell}"
47
- else:
48
- varfmt = "{shell}_source"
49
- os.environ["_DANDI_COMPLETE"] = varfmt.format(shell=shell)
44
+ os.environ["_DANDI_COMPLETE"] = f"{shell}_source"
50
45
 
51
46
  # Avoid circular import by importing within function:
52
47
  from .command import main
@@ -11,6 +11,7 @@ from .base import (
11
11
  map_to_click_exceptions,
12
12
  )
13
13
  from ..consts import SyncMode
14
+ from ..exceptions import UploadValidationError
14
15
  from ..upload import UploadExisting, UploadValidation
15
16
 
16
17
 
@@ -119,16 +120,19 @@ def upload(
119
120
  validation_companion_path(ctx.obj.logfile) if ctx.obj is not None else None
120
121
  )
121
122
 
122
- upload_(
123
- paths,
124
- existing=existing,
125
- validation=validation,
126
- dandi_instance=dandi_instance,
127
- allow_any_path=allow_any_path,
128
- upload_dandiset_metadata=upload_dandiset_metadata,
129
- devel_debug=devel_debug,
130
- jobs=jobs,
131
- jobs_per_file=jobs_per_file,
132
- sync=SyncMode(sync) if sync is not None else None,
133
- validation_log_path=companion,
134
- )
123
+ try:
124
+ upload_(
125
+ paths,
126
+ existing=existing,
127
+ validation=validation,
128
+ dandi_instance=dandi_instance,
129
+ allow_any_path=allow_any_path,
130
+ upload_dandiset_metadata=upload_dandiset_metadata,
131
+ devel_debug=devel_debug,
132
+ jobs=jobs,
133
+ jobs_per_file=jobs_per_file,
134
+ sync=SyncMode(sync) if sync is not None else None,
135
+ validation_log_path=companion,
136
+ )
137
+ except UploadValidationError as exc:
138
+ raise click.ClickException(str(exc))
@@ -0,0 +1,22 @@
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
+
9
+
10
+ @pytest.mark.ai_generated
11
+ def test_upload_validation_error_has_no_traceback(mocker: MockerFixture) -> None:
12
+ mocker.patch.object(map_to_click_exceptions, "_do_map", False)
13
+ mocker.patch(
14
+ "dandi.upload.upload",
15
+ side_effect=UploadValidationError("failed validation"),
16
+ )
17
+
18
+ result = CliRunner().invoke(upload)
19
+
20
+ assert result.exit_code == 1
21
+ assert result.output == "Error: failed validation\n"
22
+ assert "Traceback" not in result.output
@@ -12,7 +12,7 @@ from ..command import __all_commands__
12
12
 
13
13
 
14
14
  @pytest.mark.parametrize("command", (ls, validate))
15
- def test_smoke(organized_nwb_dir, command):
15
+ def test_smoke(organized_nwb_dir, command, tmp_path, monkeypatch):
16
16
  runner = CliRunner()
17
17
  r = runner.invoke(command, [str(organized_nwb_dir)])
18
18
  assert r.exit_code == 0, f"Exited abnormally. out={r.stdout}"
@@ -23,7 +23,8 @@ def test_smoke(organized_nwb_dir, command):
23
23
  # have all kinds of files which could trip the command, e.g. validate
24
24
  # could find some broken test files in the code base
25
25
  if command is not validate:
26
- with runner.isolated_filesystem():
26
+ with monkeypatch.context() as m:
27
+ m.chdir(tmp_path)
27
28
  r = runner.invoke(command, [])
28
29
  assert r.exit_code == 0, f"Exited abnormally. out={r.stdout}"
29
30
 
@@ -0,0 +1,108 @@
1
+ import os
2
+ from pathlib import Path
3
+ import subprocess
4
+
5
+ from click.testing import CliRunner
6
+ import numpy as np
7
+ import pytest
8
+ import zarr
9
+
10
+ from ..cmd_digest import digest
11
+ from ...tests.test_helpers import zarr_format_of
12
+
13
+ # The on-disk Zarr serialisation format changed between V2 (``.zgroup`` /
14
+ # ``.zarray``) and V3 (``zarr.json``, ``c/<chunk>`` layout, different default
15
+ # compressor), so the digest of "the same" Zarr data differs. Key expected
16
+ # values on the format that was *actually* produced rather than on
17
+ # ``zarr.__version__`` — zarr-python 3.x can still write V2 via
18
+ # ``zarr_format=2``.
19
+ _EXPECTED_SAMPLE_ZARR_DIGEST_BY_FORMAT = {
20
+ "2": "4313ab36412db2981c3ed391b38604d6-5--1516",
21
+ "3": "00157f091c9a6295e89eb3c4c2efaeff-5--3935",
22
+ }
23
+
24
+
25
+ def test_digest_default(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
26
+ runner = CliRunner()
27
+ monkeypatch.chdir(tmp_path)
28
+ Path("file.txt").write_bytes(b"123")
29
+ r = runner.invoke(digest, ["file.txt"])
30
+ assert r.exit_code == 0
31
+ assert r.output == "file.txt: d022646351048ac0ba397d12dfafa304-1\n"
32
+
33
+
34
+ @pytest.mark.parametrize(
35
+ "alg,filehash",
36
+ [
37
+ ("md5", "202cb962ac59075b964b07152d234b70"),
38
+ ("zarr-checksum", "202cb962ac59075b964b07152d234b70"),
39
+ ("sha1", "40bd001563085fc35165329ea1ff5c5ecbdbbeef"),
40
+ ("sha256", "a665a45920422f9d417e4867efdc4fb8a04a1f3fff1fa07e998e86f7f7a27ae3"),
41
+ (
42
+ "sha512",
43
+ "3c9909afec25354d551dae21590bb26e38d53f2173b8d3dc3eee4c047e7a"
44
+ "b1c1eb8b85103e3be7ba613b31bb5c9c36214dc9f14a42fd7a2fdb84856b"
45
+ "ca5c44c2",
46
+ ),
47
+ ],
48
+ )
49
+ def test_digest(
50
+ alg: str, filehash: str, tmp_path: Path, monkeypatch: pytest.MonkeyPatch
51
+ ) -> None:
52
+ runner = CliRunner()
53
+ monkeypatch.chdir(tmp_path)
54
+ Path("file.txt").write_bytes(b"123")
55
+ r = runner.invoke(digest, ["--digest", alg, "file.txt"])
56
+ assert r.exit_code == 0
57
+ assert r.output == f"file.txt: {filehash}\n"
58
+
59
+
60
+ def test_digest_zarr(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
61
+ # Expected digest is selected by the Zarr serialisation format that
62
+ # ``zarr.save`` actually produced (V2 vs V3 layouts have different digests).
63
+ runner = CliRunner()
64
+ monkeypatch.chdir(tmp_path)
65
+ dt = np.dtype("<i8")
66
+ zarr.save(
67
+ "sample.zarr", np.arange(1000, dtype=dt), np.arange(1000, 0, -1, dtype=dt)
68
+ )
69
+ expected = _EXPECTED_SAMPLE_ZARR_DIGEST_BY_FORMAT[
70
+ zarr_format_of(Path("sample.zarr"))
71
+ ]
72
+ r = runner.invoke(digest, ["--digest", "zarr-checksum", "sample.zarr"])
73
+ assert r.exit_code == 0
74
+ assert r.output == f"sample.zarr: {expected}\n"
75
+
76
+
77
+ def test_digest_empty_zarr(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:
78
+ runner = CliRunner()
79
+ monkeypatch.chdir(tmp_path)
80
+ os.mkdir("empty.zarr")
81
+ r = runner.invoke(digest, ["--digest", "zarr-checksum", "empty.zarr"])
82
+ assert r.exit_code == 0
83
+ assert r.output == "empty.zarr: 481a2f77ab786a0f45aafd5db0971caa-0--0\n"
84
+
85
+
86
+ def test_digest_zarr_with_excluded_dotfiles(
87
+ tmp_path: Path, monkeypatch: pytest.MonkeyPatch
88
+ ) -> None:
89
+ # See comment in `test_digest_zarr` regarding V2 vs V3 serialisation.
90
+ runner = CliRunner()
91
+ monkeypatch.chdir(tmp_path)
92
+ dt = np.dtype("<i8")
93
+ zarr.save(
94
+ "sample.zarr", np.arange(1000, dtype=dt), np.arange(1000, 0, -1, dtype=dt)
95
+ )
96
+ expected = _EXPECTED_SAMPLE_ZARR_DIGEST_BY_FORMAT[
97
+ zarr_format_of(Path("sample.zarr"))
98
+ ]
99
+ subprocess.run(["git", "init"], cwd="sample.zarr", check=True)
100
+ os.mkdir("sample.zarr/.dandi")
101
+ Path("sample.zarr", ".dandi", "somefile.txt").touch()
102
+ Path("sample.zarr", ".gitattributes").touch()
103
+ Path("sample.zarr", "arr_0", ".gitmodules").touch()
104
+ Path("sample.zarr", "arr_1", ".datalad").mkdir()
105
+ Path("sample.zarr", "arr_1", ".datalad", "config").touch()
106
+ r = runner.invoke(digest, ["--digest", "zarr-checksum", "sample.zarr"])
107
+ assert r.exit_code == 0
108
+ assert r.output == f"sample.zarr: {expected}\n"
@@ -98,10 +98,11 @@ def test_download_bad_type(mocker):
98
98
  mock_download.assert_not_called()
99
99
 
100
100
 
101
- def test_download_gui_instance_in_dandiset(mocker):
101
+ def test_download_gui_instance_in_dandiset(mocker, tmp_path, monkeypatch):
102
102
  mock_download = mocker.patch("dandi.download.download")
103
103
  runner = CliRunner()
104
- with runner.isolated_filesystem():
104
+ with monkeypatch.context() as m:
105
+ m.chdir(tmp_path)
105
106
  Path(dandiset_metadata_file).write_text("identifier: '123456'\n")
106
107
  r = runner.invoke(download, ["-i", "dandi"])
107
108
  assert r.exit_code == 0
@@ -124,10 +125,11 @@ def test_download_gui_instance_in_dandiset(mocker):
124
125
  bool(known_instances["dandi-api-local-docker-tests"].gui),
125
126
  reason="this instance now has GUI URL",
126
127
  )
127
- def test_download_api_instance_in_dandiset(mocker):
128
+ def test_download_api_instance_in_dandiset(mocker, tmp_path, monkeypatch):
128
129
  mock_download = mocker.patch("dandi.download.download")
129
130
  runner = CliRunner()
130
- with runner.isolated_filesystem():
131
+ with monkeypatch.context() as m:
132
+ m.chdir(tmp_path)
131
133
  Path(dandiset_metadata_file).write_text("identifier: '123456'\n")
132
134
  r = runner.invoke(download, ["-i", "dandi-api-local-docker-tests"])
133
135
  assert r.exit_code == 0
@@ -190,6 +190,10 @@ RETRY_STATUSES = (429, 500, 502, 503, 504)
190
190
  VIDEO_FILE_EXTENSIONS = [".mp4", ".avi", ".wmv", ".mov", ".flv", ".mkv"]
191
191
  VIDEO_FILE_MODULES = ["processing", "acquisition"]
192
192
 
193
+ #: Extensions of the images an `ExternalImage` may point at. NWB restricts `image_format` to
194
+ #: PNG, JPEG and GIF, so nothing else can be referenced by an NWB file in the first place.
195
+ IMAGE_FILE_EXTENSIONS = [".png", ".jpg", ".jpeg", ".gif"]
196
+
193
197
  ZARR_EXTENSIONS = [".ngff", ".zarr"]
194
198
 
195
199
  #: Maximum allowed depth of a Zarr directory tree
@@ -253,3 +257,12 @@ REDIRECT_HEAD_TIMEOUT = 30
253
257
 
254
258
  #: Suffix used for temporary download directories
255
259
  DOWNLOAD_SUFFIX = ".dandidownload"
260
+
261
+ #: Tolerance (in seconds) when comparing an asset's recorded mtime against the
262
+ #: mtime read back from the downloaded file under ``-e refresh``. That local
263
+ #: mtime is one we set ourselves with ``os.utime()``, so the comparison is
264
+ #: really a filesystem round trip, and not every filesystem stores mtimes at
265
+ #: the resolution ``os.stat()`` reports them at: mounted Windows volumes,
266
+ #: exFAT and some network filesystems truncate, and FAT rounds to a multiple
267
+ #: of two seconds. See https://github.com/dandi/dandi-cli/issues/1907
268
+ MTIME_TOLERANCE = 2.0
@@ -13,7 +13,7 @@ from __future__ import annotations
13
13
  from collections import Counter, deque
14
14
  from collections.abc import Callable, Iterable, Iterator, Sequence
15
15
  from dataclasses import InitVar, dataclass, field
16
- from datetime import datetime
16
+ from datetime import datetime, timezone
17
17
  from enum import Enum, StrEnum
18
18
  from functools import partial
19
19
  import hashlib
@@ -38,7 +38,13 @@ from interleave import FINISH_CURRENT, lazy_interleave
38
38
  import requests
39
39
 
40
40
  from . import get_logger
41
- from .consts import DOWNLOAD_SUFFIX, RETRY_STATUSES, SyncMode, dandiset_metadata_file
41
+ from .consts import (
42
+ DOWNLOAD_SUFFIX,
43
+ MTIME_TOLERANCE,
44
+ RETRY_STATUSES,
45
+ SyncMode,
46
+ dandiset_metadata_file,
47
+ )
42
48
  from .dandiapi import AssetType, BaseRemoteZarrAsset, RemoteDandiset
43
49
  from .dandiarchive import (
44
50
  AssetItemURL,
@@ -702,7 +708,13 @@ def _download_file(
702
708
  else:
703
709
  stat = os.stat(op.realpath(path))
704
710
  same = []
705
- if is_same_time(stat.st_mtime, mtime):
711
+ # The mtime compared against here is the one we set ourselves
712
+ # with os.utime() after the previous download, so this is
713
+ # really a filesystem round trip; tolerate the coarsest
714
+ # granularity filesystems are known to store mtimes with
715
+ # instead of assuming the value round-trips exactly. See
716
+ # https://github.com/dandi/dandi-cli/issues/1907
717
+ if is_same_time(stat.st_mtime, mtime, tolerance=MTIME_TOLERANCE):
706
718
  same.append("mtime")
707
719
  if size is not None and stat.st_size == size:
708
720
  same.append("size")
@@ -712,7 +724,21 @@ def _download_file(
712
724
  # TODO: add recording and handling of .nwb object_id
713
725
  yield _skip_file("same time and size", size=size)
714
726
  return
715
- lgr.debug(f"{path!r} - same attributes: {same}. Redownloading")
727
+ # Both timestamps are reported in UTC, which is what
728
+ # is_same_time() normalizes to before comparing them
729
+ lgr.debug(
730
+ "%r - same attributes: %s. Redownloading. "
731
+ "local mtime: %s, record mtime: %s, delta: %f s, "
732
+ "tolerance: %g s, local size: %s, record size: %s",
733
+ str(path),
734
+ same,
735
+ ensure_datetime(stat.st_mtime, tz=timezone.utc),
736
+ ensure_datetime(mtime, tz=timezone.utc),
737
+ abs(stat.st_mtime - mtime.timestamp()),
738
+ MTIME_TOLERANCE,
739
+ stat.st_size,
740
+ size,
741
+ )
716
742
 
717
743
  if size is not None:
718
744
  yield {"size": size}
@@ -91,3 +91,9 @@ class HTTP404Error(requests.HTTPError):
91
91
 
92
92
  class UploadError(Exception):
93
93
  pass
94
+
95
+
96
+ class UploadValidationError(UploadError):
97
+ """An upload could not proceed because an asset failed validation."""
98
+
99
+ pass
@@ -29,6 +29,7 @@ from .bases import (
29
29
  DandiFile,
30
30
  DandisetMetadataFile,
31
31
  GenericAsset,
32
+ ImageAsset,
32
33
  LocalAsset,
33
34
  LocalDirectoryAsset,
34
35
  LocalFileAsset,
@@ -51,6 +52,7 @@ __all__ = [
51
52
  "DandisetMetadataFile",
52
53
  "GenericAsset",
53
54
  "GenericBIDSAsset",
55
+ "ImageAsset",
54
56
  "LocalAsset",
55
57
  "LocalDirectoryAsset",
56
58
  "LocalFileAsset",
@@ -9,12 +9,13 @@ import weakref
9
9
 
10
10
  from dandi.consts import (
11
11
  BIDS_DATASET_DESCRIPTION,
12
+ IMAGE_FILE_EXTENSIONS,
12
13
  VIDEO_FILE_EXTENSIONS,
13
14
  ZARR_EXTENSIONS,
14
15
  )
15
16
  from dandi.exceptions import UnknownAssetError
16
17
 
17
- from .bases import DandiFile, GenericAsset, LocalAsset, NWBAsset, VideoAsset
18
+ from .bases import DandiFile, GenericAsset, ImageAsset, LocalAsset, NWBAsset, VideoAsset
18
19
  from .bids import (
19
20
  BIDSAsset,
20
21
  BIDSDatasetDescriptionAsset,
@@ -33,6 +34,7 @@ class DandiFileType(Enum):
33
34
  VIDEO = 3
34
35
  GENERIC = 4
35
36
  BIDS_DATASET_DESCRIPTION = 5
37
+ IMAGE = 6
36
38
 
37
39
  @staticmethod
38
40
  def classify(path: Path) -> DandiFileType:
@@ -50,6 +52,8 @@ class DandiFileType(Enum):
50
52
  return DandiFileType.NWB
51
53
  elif path.suffix in VIDEO_FILE_EXTENSIONS:
52
54
  return DandiFileType.VIDEO
55
+ elif path.suffix in IMAGE_FILE_EXTENSIONS:
56
+ return DandiFileType.IMAGE
53
57
  else:
54
58
  return DandiFileType.GENERIC
55
59
 
@@ -61,6 +65,7 @@ class DandiFileFactory:
61
65
  DandiFileType.NWB: NWBAsset,
62
66
  DandiFileType.ZARR: ZarrAsset,
63
67
  DandiFileType.VIDEO: VideoAsset,
68
+ DandiFileType.IMAGE: ImageAsset,
64
69
  DandiFileType.GENERIC: GenericAsset,
65
70
  DandiFileType.BIDS_DATASET_DESCRIPTION: BIDSDatasetDescriptionAsset,
66
71
  }
@@ -83,6 +88,7 @@ class BIDSFileFactory(DandiFileFactory):
83
88
  DandiFileType.NWB: NWBBIDSAsset,
84
89
  DandiFileType.ZARR: ZarrBIDSAsset,
85
90
  DandiFileType.VIDEO: GenericBIDSAsset,
91
+ DandiFileType.IMAGE: GenericBIDSAsset,
86
92
  DandiFileType.GENERIC: GenericBIDSAsset,
87
93
  }
88
94
 
@@ -628,6 +628,12 @@ class VideoAsset(LocalFileAsset):
628
628
  pass
629
629
 
630
630
 
631
+ class ImageAsset(LocalFileAsset):
632
+ """Representation of a local image file referenced by an NWB ``ExternalImage``"""
633
+
634
+ pass
635
+
636
+
631
637
  class GenericAsset(LocalFileAsset):
632
638
  """
633
639
  Representation of a generic regular file, one that is not of any known type
@@ -961,7 +961,7 @@ def organize(
961
961
  ]
962
962
  raise ValueError(
963
963
  "--update-external-file-paths option not specified but found "
964
- "external video files linked to the nwbfiles "
964
+ "external media files linked to the nwbfiles "
965
965
  f"{', '.join(files_list)}"
966
966
  )
967
967