Skip to content

move all documentation-specific processing to Sphinx extension#203

Open
ilia-kats wants to merge 7 commits into
mainfrom
dynamicapi_sphinx
Open

move all documentation-specific processing to Sphinx extension#203
ilia-kats wants to merge 7 commits into
mainfrom
dynamicapi_sphinx

Conversation

@ilia-kats

Copy link
Copy Markdown
Collaborator

Currently, everything is done at import time, including docstring parsing and processing. Some code also has different branches depending on whether we are currently building documentation or not to enable nice-looking internal cross-references.

This PR moves all of that to a custom Sphinx extension. This has several advantages:

  • We can use a proper docstring parsing library instead of our custom, admittedly brittle, code, without making it a runtime dependency.
  • faster import, since we don't need to do all that string processing at import time.
  • cleaner code: The core only handles what it needs to do for the dynamic API, all documentation-specific stuff is separate, instead of being sprinkled all over core.

@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 98.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 90.58%. Comparing base (78e5079) to head (2ed9eed).

Files with missing lines Patch % Lines
src/mofaflex/_core/api/utils.py 96.42% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #203      +/-   ##
==========================================
+ Coverage   90.20%   90.58%   +0.37%     
==========================================
  Files          56       56              
  Lines        5811     5745      -66     
==========================================
- Hits         5242     5204      -38     
+ Misses        569      541      -28     
Files with missing lines Coverage Δ
src/mofaflex/_core/api/_generate.py 87.03% <100.00%> (+2.29%) ⬆️
src/mofaflex/_core/api/priors.py 100.00% <100.00%> (+7.69%) ⬆️
src/mofaflex/_core/api/terms.py 95.45% <100.00%> (+13.31%) ⬆️
src/mofaflex/_core/api/types.py 100.00% <100.00%> (+21.05%) ⬆️
src/mofaflex/_core/priors/__init__.py 100.00% <100.00%> (ø)
src/mofaflex/_core/priors/spike_slab.py 92.70% <ø> (ø)
src/mofaflex/_core/terms/mofaflex.py 94.36% <100.00%> (+2.24%) ⬆️
src/mofaflex/_core/utils.py 93.89% <ø> (-0.34%) ⬇️
src/mofaflex/tl/_downstream.py 92.85% <100.00%> (+0.17%) ⬆️
src/mofaflex/_core/api/utils.py 94.62% <96.42%> (-0.12%) ⬇️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This was intended to work all along. Calling a dynamic API
method/property of a prior that is not configured for the corrent model
raises an AttributeError explaining that that method/property is only
available with a particular prior, instead of a generic AttributeError.
@ilia-kats ilia-kats force-pushed the dynamicapi_sphinx branch from 5a49471 to 2ed9eed Compare June 11, 2026 15:47
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.

1 participant