Repository navigation
DOC: Refresh contributing guide and fix stale docs build config - #850
Conversation
Partner to #836 (root CONTRIBUTING.md entrypoint) and addresses part of #834 (review contributing/developer docs for completeness). contributing.rst - Correct an out-of-date claim: the PR docs preview is built by Read the Docs, not "one of the GitHub Actions" (there is no docs-building GHA workflow). - Add the concrete commands the guide only described in prose: clone + `conda env create -f environment.yml`, an editable `flit install --symlink`, running tests (`pytest`) and style checks (the exact CI `flake8 --select=F401,F405,E231 quantecon`), and building the docs (`pip install -r docs/rtd-requirements.txt` then `make html`). - Use https for the issue-tracker and Discourse links; strip trailing whitespace. conf.py - Remove the dead `import pip` / `mock` block. It used `pip.main()` (removed in pip 10) and produced a `MagicMock` that nothing uses (the MOCK_MODULES section below it is fully commented out) -- a latent build hazard for no benefit. - Fix the `numydoc_show_class_members` typo (-> `numpydoc_`), which was silently ignored. - Modernise the deprecated intersphinx mapping to the current form `{'python': ('https://docs.python.org/3', None)}`. index.rst - Add `optimize` to the intro prose (it was in the toctree but missing from the module description); strip a trailing-whitespace line. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
There was a problem hiding this comment.
Pull request overview
This PR refreshes the contributor/developer documentation and cleans up Sphinx docs configuration to remove stale/broken settings, improving the accuracy and reliability of the project’s documentation workflow.
Changes:
- Updated the contributing guide with concrete, copy-pastable setup/test/style/docs-build commands and corrected references to Read the Docs vs GitHub Actions.
- Simplified
docs/source/conf.pyby removing a deadpip/mockinstall block, fixing a numpydoc configuration typo, and modernizing the intersphinx mapping. - Updated the docs index prose to include the
optimizemodule and removed trailing whitespace.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| docs/source/index.rst | Aligns the landing-page module list with the existing toctree and removes trailing whitespace. |
| docs/source/contributing.rst | Refreshes and concretizes contributor guidance (env setup, editable install, tests, lint, docs build) and fixes stale links/references. |
| docs/source/conf.py | Removes dead build-time code and fixes/modernizes Sphinx config (numpydoc + intersphinx). |
qe_apidoc.py globbed `../quantecon/[a-z0-9]*.py` for the base-level "tools" pages, which matches the lowercase compatibility shims (`arma.py`, `lqcontrol.py`, ...) and excludes the real implementation modules (`_arma.py`, `_lqcontrol.py`, ...). The generated stubs therefore ran `.. automodule::` against modules that are marked "not meant for public use and will be removed v0.8.0", carry no module docstrings, and emit a DeprecationWarning on every attribute access during the docs build. - Add `base_module_target()` to qe_apidoc.py: a base-level module name maps to `_<name>` when `quantecon/_<name>.py` exists (21 modules), and stays as-is otherwise (`distributions`, `quad`). Page names and toctrees are unchanged; only the automodule target moves. - Regenerate the committed stubs: 21 files under docs/source/tools/ now target the implementation modules, whose real docstrings render. Read the Docs builds from the committed stubs (it does not run qe_apidoc.py), so the regeneration is required, not just cosmetic. - Sync `split_index_template` in qe_apidoc.py with the index.rst edits from the previous commit (add `optimize` to the prose, drop the trailing-whitespace line). `make html` regenerates index.rst from this template, so without this the hand-edit would be silently reverted on the next local docs build. Regeneration now reproduces the committed index.rst byte-for-byte. - Fix `all_auto()` (the `single` mode): it called `gen_module()`, which is not defined anywhere in the file, so the mode died with NameError. Write the module template directly, matching the default mode. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
(Text below generated by ChatGPT; "I" refers to ChatGPT...) === BEGIN === I agree with the goal of avoiding the deprecated shim modules, but I don’t think In the rendered docs this produces headings such as:
Could we instead generate shim-backed pages using === END === |
Follow-up to review feedback on this PR: documenting the private implementation modules (``.. automodule:: quantecon._arma``) leaked the private module name into the rendered headings, e.g. ``class quantecon._arma.ARMA(...)``. Instead document the public objects in the ``quantecon`` namespace via ``.. currentmodule:: quantecon`` plus explicit ``autoclass`` / ``autofunction`` directives derived from each shim's ``__all__``, so the headings render as ``quantecon.ARMA`` -- the namespace the shim's own deprecation message points users to. The real docstrings still render, the deprecated shim is never imported during the build, and the private ``_module`` name no longer appears. qe_apidoc.py now classifies each ``__all__`` entry as class/function by parsing (not importing) the implementation module, so the generator stays import-free. Regenerated the 21 shim-backed stubs; genuinely public base modules (``distributions``, ``quad``) keep their ``automodule`` directive. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Thanks so much for catching this, @oyamad — you're completely right, and the write-up nailed the fix. 🙏 I've pushed c6019e3 which does exactly what you suggested: the shim-backed pages now use arma
====
.. currentmodule:: quantecon
.. autoclass:: ARMA
:members:
:undoc-members:
:show-inheritance:So the heading renders as I checked it with a minimal Sphinx build: all 21 pages now render One small tradeoff worth flagging: documenting the objects directly means the module-level docstring (e.g. "Provides functions for working with and visualizing scalar ARMA processes") is no longer shown on these pages, and a couple of those docstrings also carry developer Thanks again for the careful review! |
|
|
Heads-up on one open item before this merges: moving the base-level pages to document the public I've written this up in #853 for the team to decide (promote to |
|
@oyamad I have fixed the RTD integrations so we should get reliable rebuilds on all PRs moving forward. This is ready for final review. Thanks for this suggestions. It's a huge improvement. |
|
@mmcky Thanks. This is not blocking. We can leave it as is, or we may work on it in a separate PR. |
|
Good catch @oyamad — you're right, and it's the same pattern one level down. The fix is exactly the treatment this PR applies to the base-level pages, just one level down (
I've captured it in #854 with the scope and the dependency on #853. Agreed it's non-blocking for this PR — thanks for the thorough review! |
Summary
Partner PR to #836 (which adds the root
CONTRIBUTING.mdentrypoint) and addresses part of #834 (review the contributing/developer docs for completeness). #836 points readers atdocs/source/contributing.rst, so this refreshes that guide and, off the back of a fuller pass overdocs/, fixes stale/broken items in the docs build config and repoints the API reference at the real implementation modules instead of the deprecated compatibility shims.What changed
docs/source/contributing.rst— refresh the developer guideci.yml/ci_np2.yml, neither of which builds docs)conda env create -f environment.yml(the repo already ships this), an editableflit install --symlink, running tests (pytest), style checks (the exact CI formflake8 --select=F401,F405,E231 quantecon), and building docs (pip install -r docs/rtd-requirements.txtthenmake html)http://→https://for the issue tracker and Discourse; stripped trailing whitespacedocs/qe_apidoc.py+ regenerated stubs — stop documenting the deprecated shimsThe generator globbed
../quantecon/[a-z0-9]*.pyfor the base-level "tools" pages, which matches the lowercase compatibility shims (arma.py,lqcontrol.py, …) and excludes the real implementation modules (_arma.py,_lqcontrol.py, …). So the API reference was built with e.g... automodule:: quantecon.arma— modules marked "not meant for public use and will be removed v0.8.0", which carry no module docstrings and emit aDeprecationWarningon every attribute access during the docs build.base_module_target()maps a base-level module to_<name>whenquantecon/_<name>.pyexists (21 modules); genuinely public modules (distributions,quad) are unchanged. Page names and toctrees are untouched — only theautomoduletarget moves, and the implementation modules' real docstrings now render.docs/source/tools/are regenerated accordingly. This matters because Read the Docs builds from the committed stubs (it invokes Sphinx directly and never runsqe_apidoc.py).split_index_templateis synced with theindex.rstedits below —make htmlregeneratesindex.rstfrom this template, so without the sync the hand-edit would be silently reverted by the next local docs build. Regeneration now reproduces the committed files byte-for-byte (verified).all_auto()(thesinglemode), which calledgen_module()— a function not defined anywhere in the file — and so died withNameError.Removing the v0.8.0-overdue shims themselves is left for a separate discussion; this PR only stops the documentation from steering readers at them.
docs/source/conf.py— fix stale/broken build configimport pip/mockblock. It calledpip.main()(removed in pip 10) and built aMagicMockthat nothing uses — theMOCK_MODULESsection below it is entirely commented out. It was a latent build hazard for no benefit.numydoc_show_class_memberstypo (→numpydoc_), which meant the setting was silently ignored. The corrected value matches numpydoc's default, so rendering is unchanged.{'python': ('https://docs.python.org/3', None)}.docs/source/index.rstoptimizeto the intro description — it was in thetoctreebut omitted from the prose that lists the modules. Stripped a trailing-whitespace line.Validation
python qe_apidoc.pyand confirmed the diff is surgical: exactly the 21 shim-backed stubs change, andindex.rst/tools.rst/other landing pages regenerate byte-identical to what is committed.automoduletargets acrossdocs/source/now resolve to real module files (script-checked);conf.pyandqe_apidoc.pyparse cleanly; RST heading underlines and trailing whitespace checked.make htmlin this environment (numba/sphinx toolchain not available here), so the Read the Docs build on this PR is the authoritative rendering check.🤖 Generated with Claude Code