Skip to content

Add Sphinx documentation site with auto-generated example pages - #486

Closed
dietcoke-17 wants to merge 2 commits into
mesa:mainfrom
dietcoke-17:rtd-mesa-examples
Closed

Add Sphinx documentation site with auto-generated example pages#486
dietcoke-17 wants to merge 2 commits into
mesa:mainfrom
dietcoke-17:rtd-mesa-examples

Conversation

@dietcoke-17

@dietcoke-17 dietcoke-17 commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Fixes : #484

Add Sphinx-based documentation for mesa-examples, auto-generated from each example's own README.md, and wire it up for Read the Docs hosting.

  • docs/conf.py: Sphinx config (MyST + sphinx-copybutton + pydata-sphinx-theme) that scans examples/, gis/, and rl/ at build time and generates a page per example plus a per-category index — no docs content is hand-maintained.
  • docs/index.md: landing page linking the three category toctrees.
  • .readthedocs.yaml: RTD v2 build config.
  • pyproject.toml: new docs extra (sphinx, myst-parser, pydata-sphinx-theme, sphinx-copybutton).
  • .gitignore: ignore the auto-generated docs/examples*, docs/gis*, docs/rl* output.

@github-actions github-actions Bot added the docs label Aug 25, 2026

@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: 6b6f92bf05

ℹ️ About Codex in GitHub

Your team has set up Codex to 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 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread docs/conf.py
f"# {display_name(example_name)}\n\n"
f"```{{include}} {rel_readme}\n"
f":relative-images:\n"
f":relative-docs: {rel_dir}/\n"

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 Preserve local README links when including examples

When an included README links to sibling files (for example examples/el_farol/README.md links to el_farol.ipynb, model.py, and tests.py), those links do not start with the configured ../../examples/.../ prefix. MyST's relative-docs only rewrites links that match that prefix, so Sphinx resolves these as files under docs/examples/ that are not generated or copied, leaving broken links in the published pages. Please rewrite these README-local links to source/GitHub URLs or copy/link the target files into the docs output.

Useful? React with 👍 / 👎.

Comment thread docs/conf.py
Comment on lines +19 to +22
extensions = [
"myst_parser",
"sphinx_copybutton",
]

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 Rewrite HTML image sources from included READMEs

Several included READMEs use raw HTML image tags with relative src values, such as rl/boltzmann_money/README.md and examples/virus_antibody/README.md. This config only relies on :relative-images:, while MyST requires the optional html_image support (or preprocessing) to parse HTML images; otherwise those src="ppo_agent.gif"/src="images/..." paths pass through unchanged and the RTD HTML looks for files beside the generated page where nothing is copied. Please enable/convert these HTML images or copy them into the output.

Useful? React with 👍 / 👎.

@codebreaker32

Copy link
Copy Markdown
Collaborator

Thanks for the PR but Lets first reach on a consensus in issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Read the Docs site for mesa-examples and rewriting Readme.md as per mesa main repo style

2 participants