Skip to content

Tracker: build docs without heavy deps (mock imports) & page-level HTML build cache #802

Description

@mishig25

Tracker for the two build-speed workstreams.

Mock imports: build docs without installing heavy dependencies

  • Add --mock_deps: build docs without installing heavy dependencies #801 — mock heavy imports (torch, tensorflow, flax, jax, ...) so doc builds only need the documented library + light deps
    • Mock system: meta-path finder passing find_spec/importlib.metadata availability checks, signature-safe subclassing (PEP 560), decorator pass-through, dotted-path reprs, tuple-comparable __version__, issubclass/isinstance answering False
    • Per-library registry mock_deps/<library>.txt applied automatically by build/preview (replaces the --mock_deps flag syntax; flag kept as additive extra)
    • real:/nodeps: registry lines + doc-builder light-install (bare names pinned from the library's own metadata)
    • Shared workflows: light-install path, custom_container input removed, uv-only (setup-uv, uvx for hf sync)
    • Validated in fresh venvs: all 25 builds green (18 libraries + the optimum family, incl. transformers 723 pages byte-identical to prod on bert/llama)

Page-level HTML build cache

  • Page-level HTML build cache backed by HF storage buckets #800 — reuse prerendered page HTML from a Hugging Face storage bucket (hf://buckets/hf-doc-build/doc-build-cache) so a one-file PR doesn't rebuild hundreds of pages
    • Cache key: version-normalized generated MDX + kit tree hash + doc-builder version; cross-version reuse rewrites page URLs while assets stay pinned to the hosted source version
    • Trusted main builds write (--html_page_cache_write), PR builds read-only (cache-poisoning prevention); cache failures degrade to a normal build, never fatal

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions