Skip to content

Commit f58644a

Browse files
authored
build: ground sub-package packaging in current uv/hatch/setuptools-scm guidance (#4407)
* chore: keep sub-package pyproject.toml standalone; overlay in-repo zarr from just The packages reached in-repo zarr two different ways: zarr-http-server pinned it with `[tool.uv.sources] zarr = { path = "../.." }` in pyproject.toml, and zarr-indexing ran its tests in the repo root's environment (`uv run --project ../..`). Both reach outside the package, so neither package's unpacked sdist could run its own `just test`. Now every package's pyproject.toml stands alone, and the justfiles add the in-repo zarr as an editable overlay (`--with-editable ../..`) only when ../.. is the repository. From an sdist there is no overlay: zarr-http-server resolves zarr from PyPI, and zarr-indexing's zarr suites skip. zarr-metadata needs no zarr and is unchanged. zarr-http-server's uv.lock now resolves zarr from PyPI, and zarr-indexing CI syncs the package environment instead of the root one. Assisted-by: ClaudeCode:claude-opus-5-5 * chore: add changelog fragments for #4406 Assisted-by: ClaudeCode:claude-opus-5-5 * build: replace deprecated git_describe_command; commit zarr-metadata uv.lock setuptools-scm deprecates the top-level `git_describe_command` in favour of `scm.git.describe_command` (a DeprecationWarning builds swallow). Move the root and all three sub-packages to the new key; hatch-vcs passes raw-options to setuptools_scm.get_version, which accepts `scm` from setuptools-scm 9.0 (8.4, which the docs name, was never released), so require setuptools-scm>=9 at build time. Computed versions are unchanged. `tag.prefix`, setuptools-scm's documented monorepo option, is not reachable through hatch-vcs 0.5.0: get_version() takes no `tag` argument. uv's docs say uv.lock "should be checked into version control", with no library exception, and the other two sub-packages already commit theirs. Stop ignoring zarr-metadata's. Assisted-by: ClaudeCode:claude-opus-5-5 * ci: test each sub-package sdist standalone before release `hatch build` builds the wheel from the source tree, so nothing exercised the sdist: #4229's first cut shipped sdists whose symlinks pip refuses to unpack, and the release workflows would have uploaded them. The test_artifacts job now builds a wheel from the sdist with pip, then runs the package's `just test` and `just docs-check` from the unpacked sdist. The job has no checkout, so zarr (for zarr-http-server) resolves from PyPI, which also covers the `zarr>=3.1` floor that repo runs, overlaying in-repo zarr, never check. Assisted-by: ClaudeCode:claude-opus-5-5 * chore: add changelog fragment for #363 Assisted-by: ClaudeCode:claude-opus-5-5 * chore(zarr-metadata): relock for the docs pins aligned in #4229 Assisted-by: ClaudeCode:claude-opus-5-5 * chore: renumber changelog fragment for #4407 Assisted-by: ClaudeCode:claude-opus-5-5
1 parent bf14d68 commit f58644a

10 files changed

Lines changed: 1168 additions & 10 deletions

File tree

‎.github/workflows/zarr-http-server-release.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ jobs:
6464
uv run --with "${wheel}" --python 3.12 --no-project \
6565
python -c "import zarr_http_server; print('zarr_http_server', zarr_http_server.__version__)"
6666
67+
# The sdist has to stand alone, and `hatch build` above builds the wheel
68+
# from the source tree, not from the sdist. So build a wheel from the
69+
# sdist with pip, which unpacks it under the sdist format's rules (no
70+
# links out of the archive), then run the package's own tests and strict
71+
# docs build from the unpacked sdist. This job has no checkout, so
72+
# nothing comes from the repository; zarr, where a package uses it,
73+
# resolves from PyPI.
74+
- name: Build a wheel from the sdist with pip
75+
run: |
76+
sdist=$(ls dist/*.tar.gz)
77+
uvx --python 3.12 [email protected] wheel --no-deps --wheel-dir sdist-wheel "${sdist}"
78+
79+
- name: Install just
80+
uses: extractions/setup-crate@7577c1bdf2d95e6d65d532788f35ed79d4b1dda2 # v2.0.1
81+
with:
82+
repo: casey/just
83+
version: 1.58.0
84+
85+
- name: Test and build docs from the unpacked sdist
86+
env:
87+
UV_PYTHON: '3.12'
88+
run: |
89+
mkdir sdist
90+
tar -xzf dist/*.tar.gz -C sdist
91+
cd sdist/*/
92+
just test
93+
just docs-check
94+
6795
upload_pypi:
6896
name: Upload to PyPI
6997
needs: [build, test_artifacts]

‎.github/workflows/zarr-indexing-release.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ jobs:
6464
uv run --with "${wheel}" --python 3.12 --no-project \
6565
python -c "import zarr_indexing; print('zarr_indexing', zarr_indexing.__version__)"
6666
67+
# The sdist has to stand alone, and `hatch build` above builds the wheel
68+
# from the source tree, not from the sdist. So build a wheel from the
69+
# sdist with pip, which unpacks it under the sdist format's rules (no
70+
# links out of the archive), then run the package's own tests and strict
71+
# docs build from the unpacked sdist. This job has no checkout, so
72+
# nothing comes from the repository; zarr, where a package uses it,
73+
# resolves from PyPI.
74+
- name: Build a wheel from the sdist with pip
75+
run: |
76+
sdist=$(ls dist/*.tar.gz)
77+
uvx --python 3.12 [email protected] wheel --no-deps --wheel-dir sdist-wheel "${sdist}"
78+
79+
- name: Install just
80+
uses: extractions/setup-crate@7577c1bdf2d95e6d65d532788f35ed79d4b1dda2 # v2.0.1
81+
with:
82+
repo: casey/just
83+
version: 1.58.0
84+
85+
- name: Test and build docs from the unpacked sdist
86+
env:
87+
UV_PYTHON: '3.12'
88+
run: |
89+
mkdir sdist
90+
tar -xzf dist/*.tar.gz -C sdist
91+
cd sdist/*/
92+
just test
93+
just docs-check
94+
6795
upload_pypi:
6896
name: Upload to PyPI
6997
needs: [build, test_artifacts]

‎.github/workflows/zarr-metadata-release.yml‎

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,34 @@ jobs:
6464
uv run --with "${wheel}" --python 3.12 --no-project \
6565
python -c "import zarr_metadata; print('zarr_metadata', zarr_metadata.__version__)"
6666
67+
# The sdist has to stand alone, and `hatch build` above builds the wheel
68+
# from the source tree, not from the sdist. So build a wheel from the
69+
# sdist with pip, which unpacks it under the sdist format's rules (no
70+
# links out of the archive), then run the package's own tests and strict
71+
# docs build from the unpacked sdist. This job has no checkout, so
72+
# nothing comes from the repository; zarr, where a package uses it,
73+
# resolves from PyPI.
74+
- name: Build a wheel from the sdist with pip
75+
run: |
76+
sdist=$(ls dist/*.tar.gz)
77+
uvx --python 3.12 [email protected] wheel --no-deps --wheel-dir sdist-wheel "${sdist}"
78+
79+
- name: Install just
80+
uses: extractions/setup-crate@7577c1bdf2d95e6d65d532788f35ed79d4b1dda2 # v2.0.1
81+
with:
82+
repo: casey/just
83+
version: 1.58.0
84+
85+
- name: Test and build docs from the unpacked sdist
86+
env:
87+
UV_PYTHON: '3.12'
88+
run: |
89+
mkdir sdist
90+
tar -xzf dist/*.tar.gz -C sdist
91+
cd sdist/*/
92+
just test
93+
just docs-check
94+
6795
upload_pypi:
6896
name: Upload to PyPI
6997
needs: [build, test_artifacts]

‎.gitignore‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,5 +96,3 @@ zarr.egg-info/
9696
.claude/
9797
CLAUDE.md
9898
docs/superpowers/
99-
# zarr-metadata package lockfile (a library, not an app)
100-
packages/zarr-metadata/uv.lock

‎changes/4407.misc.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Building `zarr` from source now requires `setuptools-scm>=9`, which replaces the deprecated `git_describe_command` version option with `scm.git.describe_command`.

‎packages/zarr-http-server/pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling>=1.29.0", "hatch-vcs"]
2+
requires = ["hatchling>=1.29.0", "hatch-vcs", "setuptools-scm>=9"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -82,7 +82,7 @@ tag-pattern = '^zarr_http_server-v(?P<version>.+)$'
8282
# `git_describe_command` ensures we get the zarr_http_server tags instead of latest.
8383
# `local_scheme` strips the git commit info so the appending info is just a counter from latest tag.
8484
# test-pypi doesn't accept git commit info in tags, and the count should be enough to distinguish unique runs.
85-
raw-options = { root = "../..", git_describe_command = "git describe --dirty --tags --long --match zarr_http_server-v*", local_scheme = "no-local-version" }
85+
raw-options = { root = "../..", scm = { git = { describe_command = "git describe --dirty --tags --long --match zarr_http_server-v*" } }, local_scheme = "no-local-version" }
8686

8787
[tool.hatch.build.targets.wheel]
8888
packages = ["src/zarr_http_server"]

‎packages/zarr-indexing/pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling>=1.29.0", "hatch-vcs"]
2+
requires = ["hatchling>=1.29.0", "hatch-vcs", "setuptools-scm>=9"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -73,7 +73,7 @@ tag-pattern = '^zarr_indexing-v(?P<version>.+)$'
7373
# `git_describe_command` ensures we get the zarr_indexing tags instead of latest.
7474
# `local_scheme` strips the git commit info so the appending info is just a counter from latest tag.
7575
# test-pypi doesn't accept git commit info in tags, and the count should be enough to distinguish unique runs.
76-
raw-options = { root = "../..", git_describe_command = "git describe --dirty --tags --long --match zarr_indexing-v*", local_scheme = "no-local-version" }
76+
raw-options = { root = "../..", scm = { git = { describe_command = "git describe --dirty --tags --long --match zarr_indexing-v*" } }, local_scheme = "no-local-version" }
7777

7878
[tool.hatch.build.targets.wheel]
7979
packages = ["src/zarr_indexing"]

‎packages/zarr-metadata/pyproject.toml‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["hatchling>=1.29.0", "hatch-vcs"]
2+
requires = ["hatchling>=1.29.0", "hatch-vcs", "setuptools-scm>=9"]
33
build-backend = "hatchling.build"
44

55
[project]
@@ -68,7 +68,7 @@ tag-pattern = '^zarr_metadata-v(?P<version>.+)$'
6868
# `git_describe_command` ensures we get the zarr_metadata tags instead of latest.
6969
# `local_scheme` strips the git commit info so the appending info is just a counter from latest tag.
7070
# test-pypi doesn't accept git commit info in tags, and the count should be enough to distinguish unique runs.
71-
raw-options = { root = "../..", git_describe_command = "git describe --dirty --tags --long --match zarr_metadata-v*", local_scheme = "no-local-version" }
71+
raw-options = { root = "../..", scm = { git = { describe_command = "git describe --dirty --tags --long --match zarr_metadata-v*" } }, local_scheme = "no-local-version" }
7272

7373
[tool.hatch.build.targets.wheel]
7474
packages = ["src/zarr_metadata"]

0 commit comments

Comments
 (0)