Skip to content

Commit 9fd669f

Browse files
authored
fix(build): use an sdist allowlist so the zarr sdist stops shipping subpackages (#4261)
* fix(build): use an sdist allowlist so the zarr sdist stops shipping subpackages The root sdist config was a blocklist naming /.github, /bench and /docs, so every release shipped whatever else happened to sit in the repository root. That included the whole packages/ tree — the zarr-indexing, zarr-metadata and zarr-http-server sources, which are released as their own distributions — plus ci/, design/, towncrier fragments and other repo furniture. 2.9M of the 1.4M sdist was other people's packages. Replace it with an explicit allowlist, matching what packages/zarr-indexing and packages/zarr-metadata already do. Including /docs also fixes a second problem: tests/test_docs.py walks docs/ and testpaths collects docs/user-guide, so with docs/ excluded the shipped test suite died at collection with 'Not a file or directory'. tests/test_docs.py now runs green from an unpacked sdist (61 passed, 2 skipped), and full collection finds 7581 tests with no errors. Assisted-by: ClaudeCode:claude-opus-5 * docs(build): trim the sdist allowlist comment Drop the narration of the blocklist this replaced -- that history lives in git -- and keep only the durable rationale and the reason each entry is on the list. Assisted-by: ClaudeCode:claude-opus-5
1 parent 4aba691 commit 9fd669f

2 files changed

Lines changed: 16 additions & 3 deletions

File tree

changes/4261.misc.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The contents of the `zarr` source distribution are now defined by an explicit allowlist rather than a blocklist. Previously the sdist bundled the whole `packages/` tree — `zarr-indexing`, `zarr-metadata` and `zarr-http-server`, which are released as their own distributions — along with CI configuration and other repository files. The sdist also now ships `docs/`, so the test suite it carries can be collected and run from an unpacked sdist.

pyproject.toml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,23 @@
22
requires = ["hatchling>=1.29.0", "hatch-vcs"]
33
build-backend = "hatchling.build"
44

5+
# An allowlist, not a blocklist: anything new — a subpackage under `packages/`, a
6+
# config file in the repository root — stays out of the sdist unless it is named
7+
# here. Beyond `src` and `tests`, the entries are what keeps the shipped test
8+
# suite and docs build runnable from an unpacked sdist: `tests/test_docs.py`
9+
# walks `docs/` and `testpaths` collects `docs/user-guide`; the pages under
10+
# `docs/user-guide/examples/` pull their source out of `examples/` via pymdownx
11+
# snippet includes; `mkdocs.yml` and `mkdocs_hooks.py` let `mkdocs build` run
12+
# too. `pyproject.toml`, `README.md`, `LICENSE.txt` and `.gitignore` are added by
13+
# hatchling itself.
514
[tool.hatch.build.targets.sdist]
6-
exclude = [
7-
"/.github",
8-
"/bench",
15+
include = [
16+
"/src",
17+
"/tests",
918
"/docs",
19+
"/examples",
20+
"/mkdocs.yml",
21+
"/mkdocs_hooks.py",
1022
]
1123

1224
[project]

0 commit comments

Comments
 (0)