Auto-build project wheel for autodoc REPLs (:project: sentinel)#25
Conversation
Introduce pyrepl_autodoc_packages = ':project:' to build a PEP 427 wheel from the documented project during Sphinx HTML builds. Wheels are written to _static/wheels with --no-deps, reused when sources are unchanged, and copied into HTML output alongside other pyrepl assets. Closes #22. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
Documentation build overview
|
CI sets PYTHONWARNINGS=error globally. The pip wheel subprocess inherited that and failed on pip's internal pkg_resources DeprecationWarning. Clear PYTHONWARNINGS in the wheel build subprocess environment. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
The reuse test only synced the wheel mtime to pyproject.toml, but freshness checks all project .py files too. On CI those can be newer. Compare mtimes at whole-second precision and set the test wheel mtime from project_latest_mtime so reuse is asserted reliably. Co-authored-by: chrizzftd <chrizzFTD@users.noreply.github.com>
|
@cursoragent review |
PR Review: Auto-build project wheel (
|
| Criterion | Status |
|---|---|
| Sentinel builds wheel without consumer scripts | ✅ |
Nested pages via _asset_href |
✅ (unchanged path) |
| PyPI / explicit paths unchanged | ✅ |
| Integration test without manual wheel copy | ✅ |
| README replaces manual CI workflow | ✅ |
Suggested follow-ups (post-merge, not blockers)
- Phase 2 — auto-default
pyrepl_autodoc_packages = ":project:"whenpyrepl_doctest_blocks = "autodoc" :project:on.. py-repl:::packages:— directive-level sentinel- Validate on grill-names — simplify PR #35 to drop
build_docs_wheel.py - CHANGELOG entry for 0.4.0 if you maintain one
Summary
This PR delivers exactly what Phase 1 promised: downstream consumers can drop bespoke wheel scripts and use three lines of config. The implementation is clean, well-tested, and the two CI fixes show good attention to real runner behavior. Recommend merge.
os.path.relpath raises ValueError on Windows when the fixture and the temporary srcdir live on different drives. Fall back to an absolute pyrepl_project_root in that case; find_project_root accepts absolute paths. Co-authored-by: Cursor <cursoragent@cursor.com>


Summary
Implements Phase 1 of the streamlined downstream wheel workflow (closes #22).
Downstream projects can now enable autodoc REPL package preload without bespoke build scripts, RTD
post_installhooks, or dynamic wheel path globs inconf.py:Optional overrides for monorepos or non-default layouts:
Behavior
builder-inited, whenpyrepl_autodoc_packagesis:project::confdiror usepyrepl_project_root)pip wheel --no-depsintoconfdir/_static/wheels/_static/wheels/{distribution}-{version}-….whlfor micropipcopy_asset_files(wheels are created after Sphinx scans static paths)Tests
:project:and no pre-built wheel copy stepDocs
development.rst, andexample.rstupdated to document:project:pyrepl_project_root = "../tests/fixtures/pyrepl_test_pkg"Version
Bumps to 0.4.0 (new feature, backward compatible).