Skip to content

Make the docs build warning-free under --strict and gate it in CI (Issue #241)#265

Open
egmaminta wants to merge 3 commits into
galilai-group:mainfrom
egmaminta:fix-docs-build-warnings
Open

Make the docs build warning-free under --strict and gate it in CI (Issue #241)#265
egmaminta wants to merge 3 commits into
galilai-group:mainfrom
egmaminta:fix-docs-build-warnings

Conversation

@egmaminta

Copy link
Copy Markdown
Contributor

While going through the docs for Issue #241 I noticed mkdocs build --strict fails with 13 warnings, but CI only runs a plain mkdocs build, so they ship silently. This PR clears all of them and turns on --strict so the API reference stays clean.

  • lance: LanceDataset documented six params on one line, so griffe couldn't split them into individual entries and they rendered wrong. Each is documented separately now.
  • data/utils, data/normalization added the parameter/return annotations griffe flagged (load_dataset, convert, column_normalizer, get_scaler); forward refs kept under TYPE_CHECKING.
  • dmc: the expert-training link pointed at scripts/expert/train_policies.py, which doesn't exist; now points at the SAC trainer actually used, scripts/expert/sac_online.py.
  • nav: linked envs/piecewise.md, a finished page that wasn't reachable.

Verified these locally by running mkdocs build --strict (clean) plus pytest tests/data (passes), ruff also clean.

Refs #241: I'm open to tackle data-layer docstrings, a beginner concepts page, or the solver reference . Just let me know.

egmaminta and others added 3 commits June 18, 2026 17:34
decord ships wheels only for manylinux2010_x86_64 and win_amd64 (no macOS arm64 wheel and no sdist), so the previous unconditional dependency broke uv sync on macOS. decord is now gated to non-darwin platforms and av (PyAV) is pulled in on darwin instead.

VideoDataset selects a decoder at runtime: decord where available, otherwise a small PyAV-backed reader that exposes the same integer-indexing and get_batch API and returns identical uint8 (N, C, H, W) tensors. MP4 writing already went through imageio. Adds an av round-trip test (skipped when av is absent) and updates the backend import-error test.
mkdocs build --strict was failing with 13 warnings, but CI only ran a
plain mkdocs build, so these could (and did) slip through unnoticed.

- lance: the LanceDataset Args block lumped six parameters onto a single
  line, which griffe cannot parse into individual parameter entries.
  Document each one separately so the Dataset reference renders correctly.
- data/utils, data/normalization: add the parameter and return type
  annotations griffe flagged (load_dataset, convert, column_normalizer,
  get_scaler). Forward references stay under TYPE_CHECKING.
- dmc: the expert-training link pointed at scripts/expert/train_policies.py,
  which does not exist. Point it at the SAC trainer actually used,
  scripts/expert/sac_online.py.
- nav: add envs/piecewise.md, a finished page that was not linked anywhere.

With those resolved, switch the docs CI job to mkdocs build --strict so the
reference stays warning-free.
Comment on lines +16 to +20
if TYPE_CHECKING:
from stable_pretraining.data.transforms import WrapTorchTransform

from stable_worldmodel.data.dataset import Dataset

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do you need this?

@lucas-maes

Copy link
Copy Markdown
Collaborator

thank you for the pr! can you address my comment?

@egmaminta

Copy link
Copy Markdown
Contributor Author

thank you for the pr! can you address my comment?

Good day to you @lucas-maes ! So these two imports back the type annotations added to the autodoc'd functions in this PR:

  • Datasetload_dataset(...) -> Dataset and column_normalizer(dataset: Dataset, ...)
  • WrapTorchTransformcolumn_normalizer(...) -> WrapTorchTransform

They have to be resolvable because docs/api/dataset.md documents both functions with mkdocstrings (:::stable_worldmodel.data.load_dataset, ::: ...column_normalizer), and mkdocs.yaml has show_signature_annotations: true + signature_crossrefs: true. Griffe renders those signatures and tries to turn Dataset / WrapTorchTransform into cross-ref links.

And since this PR switches CI to mkdocs build --strict, an unresolved name there becomes a hard failure. Griffe picks names up from TYPE_CHECKING blocks statically, so this is what makes them resolve. They're under TYPE_CHECKING rather than imported normally on purpose:

  • WrapTorchTransform lives in stable_pretraining and is already imported lazily inside column_normalizer's body, specifically so importing data.utils doesn't eagerly drag in stable_pretraining; the guard just hands the symbol to the checker/docs without undoing that.
  • A top-level from stable_worldmodel.data.dataset import Dataset would be an import-ordering hazard because data/__init__.py runs from .utils import * before from .dataset import *.
  • With from __future__ import annotations, the annotations stay strings at runtime and this block is skipped, so there's zero runtime cost.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants