|
| 1 | +# CLAUDE.md |
| 2 | + |
| 3 | +This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. |
| 4 | + |
| 5 | +## Purpose |
| 6 | + |
| 7 | +This is a Sphinx documentation site — a collection of copy-paste Python library examples organized as a reference/tutorial book. Each library lives in its own subdirectory with a `README.rst` file and standalone `.py` example scripts. |
| 8 | + |
| 9 | +## Build Commands |
| 10 | + |
| 11 | +```bash |
| 12 | +# Build HTML documentation |
| 13 | +uv sync |
| 14 | +uv run make html |
| 15 | +``` |
| 16 | + |
| 17 | +The built site goes to `build/html/`. Open `build/html/index.html` to preview locally. |
| 18 | + |
| 19 | +## Project Structure |
| 20 | + |
| 21 | +- **`index.rst`** — top-level table of contents, controls what appears in the docs |
| 22 | +- **`conf.py`** — Sphinx configuration (theme: furo, extensions: myst_parser, sphinx_design, sphinx_copybutton) |
| 23 | +- **`<library>/README.rst`** — documentation page for each library (RST format) |
| 24 | +- **`<library>/*.py`** — standalone example scripts included via `.. literalinclude::` directives |
| 25 | +- **`<library>/*.png`** — output images referenced with `.. figure::` directives |
| 26 | +- **`_static/`** — CSS and logo assets |
| 27 | + |
| 28 | +## Content Conventions |
| 29 | + |
| 30 | +Each library page follows this pattern: |
| 31 | +1. A question as the section heading (e.g., "How to draw a bar chart?") |
| 32 | +2. Brief description of the library |
| 33 | +3. Install instruction in a `.. code::` block |
| 34 | +4. One or more examples using `.. literalinclude:: script.py` |
| 35 | +5. Optional `.. figure:: image.png` showing expected output |
| 36 | +6. A `.. seealso::` block linking to official docs |
| 37 | + |
| 38 | +Example scripts should be **self-contained and runnable** — no shared utilities or imports from sibling directories. |
| 39 | + |
| 40 | +## Adding a New Library |
| 41 | + |
| 42 | +1. Create a subdirectory `<library>/` |
| 43 | +2. Write `<library>/README.rst` following the conventions above |
| 44 | +3. Add standalone `.py` example scripts |
| 45 | +4. Add the entry to `index.rst` under the appropriate section: `<library>/README.rst` |
| 46 | +5. Run `make html` to verify it builds without warnings |
| 47 | + |
| 48 | +## Formats |
| 49 | + |
| 50 | +- Documentation pages use **RST** (`.rst`), not Markdown — `myst_parser` is installed but RST is the primary format used |
| 51 | +- The `exclude_patterns` in `conf.py` excludes `README.md` (the GitHub-facing readme) and `learning_goals.md` files from the Sphinx build |
0 commit comments