Skip to content

Commit

Permalink
use src layout and use hatch for packaging (zarr-developers#1592)
Browse files Browse the repository at this point in the history
* src layout + migrate to hatch

* feat: git archival support

* rm test generated files

* Apply suggestions from code review

* Use relative imports

---------

Co-authored-by: Saransh Chopra <[email protected]>
  • Loading branch information
d-v-b and Saransh-cpp authored Feb 6, 2024
1 parent b82311d commit f8874bf
Show file tree
Hide file tree
Showing 73 changed files with 19 additions and 19 deletions.
4 changes: 4 additions & 0 deletions .git_archival.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node: $Format:%H$
node-date: $Format:%cI$
describe-name: $Format:%(describe:tags=true,match=*[0-9]*)$
ref-names: $Format:%D$
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
*.py linguist-language=python
*.ipynb linguist-documentation
.git_archival.txt export-subst
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ target/
# Jupyter
.ipynb_checkpoints/

# setuptools-scm
zarr/version.py
# VCS versioning
src/zarr/_version.py

# emacs
*~
Expand Down
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ repos:
rev: v1.7.1
hooks:
- id: mypy
files: zarr
files: src
args: []
additional_dependencies:
- types-redis
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
19 changes: 7 additions & 12 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -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]
Expand Down Expand Up @@ -34,7 +34,7 @@ classifiers = [
'Programming Language :: Python :: 3.11',
'Programming Language :: Python :: 3.12',
]
license = { text = "MIT" }
license = "MIT"

[project.optional-dependencies]
jupyter = [
Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion zarr/__init__.py → src/zarr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion zarr/_storage/v3.py → src/zarr/_storage/v3.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion zarr/tests/test_core.py → tests/test_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit f8874bf

Please sign in to comment.