Skip to content

docs: split examples into topic pages backed by runnable scripts - #1350

Merged
MilesCranmer merged 5 commits into
astroautomata:masterfrom
MilesCranmerBot:docs-examples
Sep 16, 2026
Merged

MilesCranmer merged 5 commits into
astroautomata:masterfrom
MilesCranmerBot:docs-examples

Conversation

@MilesCranmerBot

@MilesCranmerBot MilesCranmerBot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Split the examples index into eight topic pages under docs/src/examples/, with runnable scripts under examples/ and matching sidebar navigation.

The pages cover standard fitting, expression specifications, custom objectives, physics and units, search configuration, instrumentation, custom value types, and symbolic controllers. They include the recovered equations while keeping run-by-run analysis out of the walkthroughs. The Hopper script replays the saved controller; the agent-loop example uses stored proposals.

Twelve demonstration videos are hosted separately in PySR_Docs #11. Embeds use immutable URLs pinned to asset commit 38b98e49200ee5e1629a62fb7e0b811d64286154; no MP4 files are added to this repository.

Verification:

  • VitePress production build passes.
  • Four structural example checks pass.
  • All twelve hosted videos load and decode in the documentation preview.
  • The documented adaptive-plugin fit and prediction run successfully.
  • The Hopper replay reproduces 16 passing starts out of 20 with Gymnasium 1.2.2 and MuJoCo 3.3.7.
  • Repository pre-commit hooks pass.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7acca754de

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

alive = np.ones(len(state), dtype=bool)
for _ in range(HORIZON):
raw = np.asarray(model.predict(observe(state), index=index), dtype=float)
force = FORCE_CAP * np.clip(np.nan_to_num(raw, nan=0.0), -1.0, 1.0)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject non-finite policy outputs during held-out validation

When the policy returns NaN or infinity for a still-alive held-out trajectory, this conversion silently turns NaN into zero force and infinities into saturated force, so check() can report that all held-out starts succeeded even though the policy was undefined. The Julia training objective explicitly rejects the same outputs with Inf; mark the affected held-out starts invalid rather than sanitizing their actions.

Useful? React with 👍 / 👎.

Comment thread examples/test_examples.py
Comment on lines +81 to +83
@pytest.mark.parametrize("name", [n for n, s in EXAMPLES.items() if s <= FAST_SECONDS])
def test_example(name):
run(name)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Wire the new example tests into CI

These tests are never discovered by the current CI: the test steps in .github/workflows/CI.yml:82-89 and .github/workflows/CI_large_nightly.yml:48-49 invoke python -m pysr test, whose dispatcher only loads unittest classes under pysr/test, while the documentation workflow only generates markdown. Consequently neither these fast runnable examples nor the later documentation invariants execute on pull requests, and regressions can merge despite the added coverage.

Useful? React with 👍 / 👎.

@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

MilesCranmerBot and others added 2 commits September 10, 2026 20:11
The single examples page had grown to sixteen numbered sections, and the code
in it was not runnable as written. Each section is now a page grouped by what
the reader wants, and every code block is a slice of a script under `examples/`
that runs on its own.

`examples/test_examples.py` runs each script and checks the result the page
claims, and holds the structural invariants: the sidebar, the index, and the
page bodies agree on one reading order, no example is missing from the index,
and no string literal is split across lines in a way the docs blocks hide.

Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
MilesCranmerBot and others added 2 commits September 13, 2026 02:07
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@MilesCranmer
MilesCranmer enabled auto-merge (squash) September 13, 2026 21:08
Co-authored-by: Miles Cranmer <miles.cranmer@gmail.com>
@MilesCranmer
MilesCranmer merged commit 49773c3 into astroautomata:master Sep 16, 2026
49 checks passed
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