fix(docs): build subpackage docs from the package directory - #286
Open
d-v-b wants to merge 1 commit into
Open
Conversation
Read the Docs pointed `-f` at each package's mkdocs.yml from the repo root. mkdocs resolves some settings relative to the current working directory rather than to the config file, so building from elsewhere looks for them in the wrong place -- and silently, because the paths are valid, just wrong. zarr-indexing hit this at v0.2.0: `pymdownx.snippets` has a relative `base_path` of `[docs, examples]`, so `--8<-- "snippets/canonical_slice.py"` resolved against the repo root and searched zarr-python's own docs/ rather than the package's. The build failed with SnippetMissingError while `just docs-check` passed, because that runs from the package directory. Building from the package directory makes the Read the Docs invocation identical to the local and CI ones, so a green build there means a green build here. $READTHEDOCS_OUTPUT is absolute, so the cd does not affect where the site lands. Applied to all three packages. Only zarr-indexing is failing today; zarr-metadata and zarr-http-server do not use snippets, so for them this is preventive -- the hazard is any config resolved against the working directory, and it would show up only on Read the Docs. Assisted-by: ClaudeCode:claude-opus-5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🤖 AI text below 🤖
The failure
The
zarr_indexing-v0.2.0docs build fails on Read the Docs:The file is not missing. It is at
packages/zarr-indexing/docs/snippets/canonical_slice.py, and the build is looking somewhere else.Cause
pymdownx.snippetsresolves a relativebase_pathagainst the current working directory, not against the config file.zarr-indexing/mkdocs.ymlhas:and
docs/index.mddoes--8<-- "snippets/canonical_slice.py:landing-quickstart", so the snippet is looked for at<cwd>/docs/snippets/canonical_slice.py:just docs-check, CIpackages/zarr-indexingpackages/zarr-indexing/docs/snippets/…-ffrom the repo root)<repo>/docs/snippets/…— zarr-python's core docsThat is why CI is green and Read the Docs is not.
Fix
Build from inside the package instead of pointing
-fat its config from the repo root:$READTHEDOCS_OUTPUTis absolute, so thecddoes not change where the site lands.This is preferred over making
base_pathconfig-relative, which would also require rewriting every--8<--path. More importantly it makes the Read the Docs invocation identical to the local and CI ones, so a greenjust docs-checkmeans a green Read the Docs build — the class of bug goes away rather than this one instance of it.Scope
Applied to all three packages. Only
zarr-indexingis failing today;zarr-metadataandzarr-http-serverdo not use snippets, so for them this is preventive — the hazard is any setting resolved against the working directory, and it would surface only on Read the Docs, after a release.Verification
d9af955fin a scratch worktree: building from the repo root with-ffails with the identical error; building from the package directory succeeds.zarr-indexing'sindex.html.SnippetMissingError, confirming the diff is what changes the outcome.Note
Read the Docs builds tags, so this does not repair the published
zarr_indexing-v0.2.0build. A patch release cut frommainafter this merges will build correctly.