diff --git a/.git_archival.txt b/.git_archival.txt new file mode 100644 index 0000000000..8fb235d704 --- /dev/null +++ b/.git_archival.txt @@ -0,0 +1,4 @@ +node: $Format:%H$ +node-date: $Format:%cI$ +describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$ +ref-names: $Format:%D$ diff --git a/.gitattributes b/.gitattributes index b6115e6e49..57eb8a8807 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,2 +1,3 @@ *.py linguist-language=python *.ipynb linguist-documentation +.git_archival.txt export-subst diff --git a/.gitignore b/.gitignore index 7de405d8a0..53b6cd356d 100644 --- a/.gitignore +++ b/.gitignore @@ -62,8 +62,8 @@ target/ # Jupyter .ipynb_checkpoints/ -# setuptools-scm -zarr/version.py +# VCS versioning +src/zarr/_version.py # emacs *~ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index a8ee599137..10aff8b4c6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -30,7 +30,7 @@ repos: rev: v1.7.1 hooks: - id: mypy - files: zarr + files: src args: [] additional_dependencies: - types-redis diff --git a/docs/contributing.rst b/docs/contributing.rst index 91606b7276..a65b3d104d 100644 --- a/docs/contributing.rst +++ b/docs/contributing.rst @@ -335,7 +335,7 @@ of the storage specification that is currently implemented is stored under the Note that the Zarr test suite includes a data fixture and tests to try and ensure that data format compatibility is not accidentally broken. See the -:func:`test_format_compatibility` function in the :mod:`zarr.tests.test_storage` module +:func:`test_format_compatibility` function in the :mod:`tests.test_storage` module for details. When to make a release diff --git a/pyproject.toml b/pyproject.toml index 4cd3b05b65..4b3b07f23b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [build-system] -requires = ["setuptools>=64.0.0", "setuptools-scm>1.5.4"] -build-backend = "setuptools.build_meta" +requires = ["hatchling", "hatch-vcs"] +build-backend = "hatchling.build" [project] @@ -34,7 +34,7 @@ classifiers = [ 'Programming Language :: Python :: 3.11', 'Programming Language :: Python :: 3.12', ] -license = { text = "MIT" } +license = "MIT" [project.optional-dependencies] jupyter = [ @@ -68,18 +68,13 @@ exclude_lines = [ [tool.coverage.run] omit = [ - "zarr/meta_v1.py", + "src/zarr/meta_v1.py", "bench/compress_normal.py", ] -[tool.setuptools] -packages = ["zarr", "zarr._storage", "zarr.tests"] -license-files = ["LICENSE.txt"] - -[tool.setuptools_scm] -version_scheme = "guess-next-dev" -local_scheme = "dirty-tag" -write_to = "zarr/version.py" +[tool.hatch] +version.source = "vcs" +build.hooks.vcs.version-file = "src/zarr/_version.py" [tool.ruff] line-length = 100 diff --git a/zarr/__init__.py b/src/zarr/__init__.py similarity index 96% rename from zarr/__init__.py rename to src/zarr/__init__.py index 6cecb40af8..b3c1e05b7e 100644 --- a/zarr/__init__.py +++ b/src/zarr/__init__.py @@ -49,7 +49,7 @@ ZipStore, ) from zarr.sync import ProcessSynchronizer, ThreadSynchronizer -from zarr.version import version as __version__ +from zarr._version import version as __version__ # in case setuptools scm screw up and find version to be 0.0.0 assert not __version__.startswith("0.0.0") diff --git a/zarr/_storage/__init__.py b/src/zarr/_storage/__init__.py similarity index 100% rename from zarr/_storage/__init__.py rename to src/zarr/_storage/__init__.py diff --git a/zarr/_storage/absstore.py b/src/zarr/_storage/absstore.py similarity index 100% rename from zarr/_storage/absstore.py rename to src/zarr/_storage/absstore.py diff --git a/zarr/_storage/store.py b/src/zarr/_storage/store.py similarity index 100% rename from zarr/_storage/store.py rename to src/zarr/_storage/store.py diff --git a/zarr/_storage/v3.py b/src/zarr/_storage/v3.py similarity index 99% rename from zarr/_storage/v3.py rename to src/zarr/_storage/v3.py index 00dc085dac..8ab54984b7 100644 --- a/zarr/_storage/v3.py +++ b/src/zarr/_storage/v3.py @@ -163,7 +163,7 @@ def setitems(self, values): values = {self._normalize_key(key): val for key, val in values.items()} # initialize the /data/root/... folder corresponding to the array! - # Note: zarr.tests.test_core_v3.TestArrayWithFSStoreV3PartialRead fails + # Note: tests.test_core_v3.TestArrayWithFSStoreV3PartialRead fails # without this explicit creation of directories subdirectories = set(os.path.dirname(v) for v in values.keys()) for subdirectory in subdirectories: diff --git a/zarr/_storage/v3_storage_transformers.py b/src/zarr/_storage/v3_storage_transformers.py similarity index 100% rename from zarr/_storage/v3_storage_transformers.py rename to src/zarr/_storage/v3_storage_transformers.py diff --git a/zarr/attrs.py b/src/zarr/attrs.py similarity index 100% rename from zarr/attrs.py rename to src/zarr/attrs.py diff --git a/zarr/codecs.py b/src/zarr/codecs.py similarity index 100% rename from zarr/codecs.py rename to src/zarr/codecs.py diff --git a/zarr/context.py b/src/zarr/context.py similarity index 100% rename from zarr/context.py rename to src/zarr/context.py diff --git a/zarr/convenience.py b/src/zarr/convenience.py similarity index 100% rename from zarr/convenience.py rename to src/zarr/convenience.py diff --git a/zarr/core.py b/src/zarr/core.py similarity index 100% rename from zarr/core.py rename to src/zarr/core.py diff --git a/zarr/creation.py b/src/zarr/creation.py similarity index 100% rename from zarr/creation.py rename to src/zarr/creation.py diff --git a/zarr/errors.py b/src/zarr/errors.py similarity index 100% rename from zarr/errors.py rename to src/zarr/errors.py diff --git a/zarr/hierarchy.py b/src/zarr/hierarchy.py similarity index 100% rename from zarr/hierarchy.py rename to src/zarr/hierarchy.py diff --git a/zarr/indexing.py b/src/zarr/indexing.py similarity index 100% rename from zarr/indexing.py rename to src/zarr/indexing.py diff --git a/zarr/meta.py b/src/zarr/meta.py similarity index 100% rename from zarr/meta.py rename to src/zarr/meta.py diff --git a/zarr/meta_v1.py b/src/zarr/meta_v1.py similarity index 100% rename from zarr/meta_v1.py rename to src/zarr/meta_v1.py diff --git a/zarr/n5.py b/src/zarr/n5.py similarity index 100% rename from zarr/n5.py rename to src/zarr/n5.py diff --git a/zarr/storage.py b/src/zarr/storage.py similarity index 100% rename from zarr/storage.py rename to src/zarr/storage.py diff --git a/zarr/sync.py b/src/zarr/sync.py similarity index 100% rename from zarr/sync.py rename to src/zarr/sync.py diff --git a/zarr/util.py b/src/zarr/util.py similarity index 100% rename from zarr/util.py rename to src/zarr/util.py diff --git a/zarr/v3/__init__.py b/src/zarr/v3/__init__.py similarity index 100% rename from zarr/v3/__init__.py rename to src/zarr/v3/__init__.py diff --git a/zarr/tests/__init__.py b/src/zarr/v3/abc/__init__.py similarity index 100% rename from zarr/tests/__init__.py rename to src/zarr/v3/abc/__init__.py diff --git a/zarr/v3/abc/array.py b/src/zarr/v3/abc/array.py similarity index 100% rename from zarr/v3/abc/array.py rename to src/zarr/v3/abc/array.py diff --git a/zarr/v3/abc/codec.py b/src/zarr/v3/abc/codec.py similarity index 100% rename from zarr/v3/abc/codec.py rename to src/zarr/v3/abc/codec.py diff --git a/zarr/v3/abc/group.py b/src/zarr/v3/abc/group.py similarity index 100% rename from zarr/v3/abc/group.py rename to src/zarr/v3/abc/group.py diff --git a/zarr/v3/abc/store.py b/src/zarr/v3/abc/store.py similarity index 100% rename from zarr/v3/abc/store.py rename to src/zarr/v3/abc/store.py diff --git a/zarr/v3/array.py b/src/zarr/v3/array.py similarity index 100% rename from zarr/v3/array.py rename to src/zarr/v3/array.py diff --git a/zarr/v3/array_v2.py b/src/zarr/v3/array_v2.py similarity index 100% rename from zarr/v3/array_v2.py rename to src/zarr/v3/array_v2.py diff --git a/zarr/v3/codecs/__init__.py b/src/zarr/v3/codecs/__init__.py similarity index 100% rename from zarr/v3/codecs/__init__.py rename to src/zarr/v3/codecs/__init__.py diff --git a/zarr/v3/codecs/blosc.py b/src/zarr/v3/codecs/blosc.py similarity index 100% rename from zarr/v3/codecs/blosc.py rename to src/zarr/v3/codecs/blosc.py diff --git a/zarr/v3/codecs/bytes.py b/src/zarr/v3/codecs/bytes.py similarity index 100% rename from zarr/v3/codecs/bytes.py rename to src/zarr/v3/codecs/bytes.py diff --git a/zarr/v3/codecs/crc32c_.py b/src/zarr/v3/codecs/crc32c_.py similarity index 100% rename from zarr/v3/codecs/crc32c_.py rename to src/zarr/v3/codecs/crc32c_.py diff --git a/zarr/v3/codecs/gzip.py b/src/zarr/v3/codecs/gzip.py similarity index 100% rename from zarr/v3/codecs/gzip.py rename to src/zarr/v3/codecs/gzip.py diff --git a/zarr/v3/codecs/registry.py b/src/zarr/v3/codecs/registry.py similarity index 100% rename from zarr/v3/codecs/registry.py rename to src/zarr/v3/codecs/registry.py diff --git a/zarr/v3/codecs/sharding.py b/src/zarr/v3/codecs/sharding.py similarity index 100% rename from zarr/v3/codecs/sharding.py rename to src/zarr/v3/codecs/sharding.py diff --git a/zarr/v3/codecs/transpose.py b/src/zarr/v3/codecs/transpose.py similarity index 100% rename from zarr/v3/codecs/transpose.py rename to src/zarr/v3/codecs/transpose.py diff --git a/zarr/v3/codecs/zstd.py b/src/zarr/v3/codecs/zstd.py similarity index 100% rename from zarr/v3/codecs/zstd.py rename to src/zarr/v3/codecs/zstd.py diff --git a/zarr/v3/common.py b/src/zarr/v3/common.py similarity index 100% rename from zarr/v3/common.py rename to src/zarr/v3/common.py diff --git a/zarr/v3/group.py b/src/zarr/v3/group.py similarity index 100% rename from zarr/v3/group.py rename to src/zarr/v3/group.py diff --git a/zarr/v3/group_v2.py b/src/zarr/v3/group_v2.py similarity index 100% rename from zarr/v3/group_v2.py rename to src/zarr/v3/group_v2.py diff --git a/zarr/v3/indexing.py b/src/zarr/v3/indexing.py similarity index 100% rename from zarr/v3/indexing.py rename to src/zarr/v3/indexing.py diff --git a/zarr/v3/metadata.py b/src/zarr/v3/metadata.py similarity index 100% rename from zarr/v3/metadata.py rename to src/zarr/v3/metadata.py diff --git a/zarr/v3/store.py b/src/zarr/v3/store.py similarity index 100% rename from zarr/v3/store.py rename to src/zarr/v3/store.py diff --git a/zarr/v3/sync.py b/src/zarr/v3/sync.py similarity index 100% rename from zarr/v3/sync.py rename to src/zarr/v3/sync.py diff --git a/zarr/v3/abc/__init__.py b/tests/__init__.py similarity index 100% rename from zarr/v3/abc/__init__.py rename to tests/__init__.py diff --git a/zarr/tests/conftest.py b/tests/conftest.py similarity index 100% rename from zarr/tests/conftest.py rename to tests/conftest.py diff --git a/zarr/tests/data/store.zip b/tests/data/store.zip similarity index 100% rename from zarr/tests/data/store.zip rename to tests/data/store.zip diff --git a/zarr/tests/data/store/foo b/tests/data/store/foo similarity index 100% rename from zarr/tests/data/store/foo rename to tests/data/store/foo diff --git a/zarr/tests/test_attrs.py b/tests/test_attrs.py similarity index 100% rename from zarr/tests/test_attrs.py rename to tests/test_attrs.py diff --git a/zarr/tests/test_codecs_v3.py b/tests/test_codecs_v3.py similarity index 100% rename from zarr/tests/test_codecs_v3.py rename to tests/test_codecs_v3.py diff --git a/zarr/tests/test_convenience.py b/tests/test_convenience.py similarity index 100% rename from zarr/tests/test_convenience.py rename to tests/test_convenience.py diff --git a/zarr/tests/test_core.py b/tests/test_core.py similarity index 99% rename from zarr/tests/test_core.py rename to tests/test_core.py index c5a43ed39d..87bf72e9b0 100644 --- a/zarr/tests/test_core.py +++ b/tests/test_core.py @@ -35,7 +35,7 @@ BaseStore, v3_api_available, ) -from .._storage.v3_storage_transformers import ( +from zarr._storage.v3_storage_transformers import ( DummyStorageTransfomer, ShardingStorageTransformer, v3_sharding_available, diff --git a/zarr/tests/test_creation.py b/tests/test_creation.py similarity index 100% rename from zarr/tests/test_creation.py rename to tests/test_creation.py diff --git a/zarr/tests/test_dim_separator.py b/tests/test_dim_separator.py similarity index 100% rename from zarr/tests/test_dim_separator.py rename to tests/test_dim_separator.py diff --git a/zarr/tests/test_filters.py b/tests/test_filters.py similarity index 100% rename from zarr/tests/test_filters.py rename to tests/test_filters.py diff --git a/zarr/tests/test_hierarchy.py b/tests/test_hierarchy.py similarity index 100% rename from zarr/tests/test_hierarchy.py rename to tests/test_hierarchy.py diff --git a/zarr/tests/test_indexing.py b/tests/test_indexing.py similarity index 100% rename from zarr/tests/test_indexing.py rename to tests/test_indexing.py diff --git a/zarr/tests/test_info.py b/tests/test_info.py similarity index 100% rename from zarr/tests/test_info.py rename to tests/test_info.py diff --git a/zarr/tests/test_meta.py b/tests/test_meta.py similarity index 100% rename from zarr/tests/test_meta.py rename to tests/test_meta.py diff --git a/zarr/tests/test_meta_array.py b/tests/test_meta_array.py similarity index 100% rename from zarr/tests/test_meta_array.py rename to tests/test_meta_array.py diff --git a/zarr/tests/test_n5.py b/tests/test_n5.py similarity index 100% rename from zarr/tests/test_n5.py rename to tests/test_n5.py diff --git a/zarr/tests/test_storage.py b/tests/test_storage.py similarity index 100% rename from zarr/tests/test_storage.py rename to tests/test_storage.py diff --git a/zarr/tests/test_storage_v3.py b/tests/test_storage_v3.py similarity index 100% rename from zarr/tests/test_storage_v3.py rename to tests/test_storage_v3.py diff --git a/zarr/tests/test_sync.py b/tests/test_sync.py similarity index 100% rename from zarr/tests/test_sync.py rename to tests/test_sync.py diff --git a/zarr/tests/test_util.py b/tests/test_util.py similarity index 100% rename from zarr/tests/test_util.py rename to tests/test_util.py diff --git a/zarr/tests/util.py b/tests/util.py similarity index 100% rename from zarr/tests/util.py rename to tests/util.py