Skip to content

Restructure example docs - #138

Merged
amacati merged 6 commits into
mainfrom
fix.docs
Oct 20, 2026
Merged

amacati merged 6 commits into
mainfrom
fix.docs

Conversation

@ratheron

Copy link
Copy Markdown
Collaborator

With this PR, the docs contain all examples (tested with new test). To make it less crowded (#131), the docs are strucuted as the example folders. Also, instead of having the information per example twice, we only have the docstring, which is also written into the docs during building (new script for that). Since the code of some examples is long, the code is now collapsible.

Additionally, I added some quality of life fixes, such as a --plot flag with no plotting when running regularly (would crash in the base env) and unifying the naming inside the examples (all now use trajectory() for the reference and similar changes).

This PR turned out longer than intended. Most of it is just shifting things around though. If I should split this into multiple PRs, lmk.

@ratheron
ratheron requested a review from amacati October 13, 2026 21:19
@amacati

amacati commented Oct 14, 2026

Copy link
Copy Markdown
Collaborator

As we discussed before, the videos should not be included in this PR. We can add the CI job to generate them on the fly in a follow-up

@ratheron

Copy link
Copy Markdown
Collaborator Author

Done

Comment thread docs/examples/index.md
Comment thread examples/control/body_rate.py Outdated
Comment thread examples/control/dynamics.py Outdated
Comment thread examples/environments/gymnasium_env.py Outdated
Comment thread examples/jax/gradient.py Outdated
Comment thread examples/rendering/splat_camera.py Outdated
Comment thread examples/rendering/splat_depth.py Outdated
Comment thread examples/rendering/splat_depth.py Outdated
Comment thread examples/rendering/splat_gradients.py Outdated
Comment on lines +63 to +70
def test_examples_in_docs():
"""Every example script has a section in the example docs, and every section has a script."""
directive = re.compile(r'^--8<-- example "examples/(.+)"$', re.MULTILINE)
pages = DOCS_EXAMPLES_DIR.glob("*.md")
documented = {path for page in pages for path in directive.findall(page.read_text())}
scripts = {path.relative_to(EXAMPLES_DIR).as_posix() for path in EXAMPLES_DIR.rglob("*.py")}
assert not scripts - documented, f"Missing from docs/examples: {sorted(scripts - documented)}"
assert not documented - scripts, f"Stale in docs/examples: {sorted(documented - scripts)}"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? We are already testing the examples outside the docs, aren't we?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not testing the examples, rather it tests if all examples are in the docs and all doc examples actually exist. We could also move this check into the docs build if you prefer. Automatically building the docs from the examples folder doesn't work, since we have ordered the docs to be easier digestible.

ratheron and others added 3 commits October 20, 2026 11:12
Co-authored-by: Martin Schuck <57562633+amacati@users.noreply.github.com>
@ratheron
ratheron requested a review from amacati October 20, 2026 11:22
@amacati
amacati merged commit 58987f8 into main Oct 20, 2026
6 checks passed
@amacati amacati mentioned this pull request Oct 20, 2026
@amacati
amacati deleted the fix.docs branch October 20, 2026 12:39
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.

2 participants