docs: implement Sphinx-Autodoc harness and fix ARModel docstring form… - #428
Closed
alphaleporus wants to merge 1 commit into
Closed
docs: implement Sphinx-Autodoc harness and fix ARModel docstring form…#428alphaleporus wants to merge 1 commit into
alphaleporus wants to merge 1 commit into
Conversation
Collaborator
Author
|
Hi @sadamov, completely understood! Apologies for combining the infrastructure POC with the docstring fixes; I will make sure to keep future PRs strictly scoped to single issues following the original template. I'll open a separate, clean PR just for the ar_model.py formatting fixes, and I will move my architectural findings regarding Autodoc vs. AutoAPI over to the discussion in #196/#230. Thanks for pointing me in the right direction! |
21 tasks
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.
Describe your changes
Summary of the changes:
This PR implements a working Sphinx-Autodoc proof-of-concept (POC) to demonstrate the viability of runtime introspection for the
neural-lamdocumentation pipeline. It successfully captures the PyTorch Lightning lifecycle hooks inARModeland the@propertydecorators in thedatastoreabstraction layer. Additionally, it fixes existing docstring formatting errors (unexpected unindents) inARModelthat were exposed once introspection was enabled.Motivation and context:
As discussed in the
#gsoc-project2channel, building a robust documentation pipeline forneural-lamrequires handling a decorator-heavy, pure Python architecture. Static analysis tools (like AutoAPI) struggle to capture runtime-injected attributes and PyTorch Lightning hooks without heavy manual intervention.This POC proves that Autodoc (runtime introspection) is the correct architectural choice. To ensure this pipeline will survive in a lightweight, CPU-only CI/CD environment (e.g., GitHub Actions), I implemented a two-tier mocking strategy:
autodoc_mock_importsfor heavy ML dependencies (torch,pytorch_lightning,xarray, etc.) to preserve class inheritance visibility.MagicMock): Implemented a customsys.modulesoverride specifically formlflowandtueplots. Standard string-mocking causes Sphinx to crash when parsing Python 3.10+ union type hints (e.g.,list | np.ndarray) in the logger modules, or when executing module-level plotting math. This setup securely bypasses those execution conflicts while preserving the realnumpybase.Dependencies:
sphinx,sphinx-rtd-theme, andsphinx-autodoc-typehintstopyproject.toml[dev-dependencies]via PDM.Issue Link
Relates to #61, #69
Type of change
Checklist before requesting a review
ARModeldocstrings)conf.pyexplaining the mocking strategy)