Skip to content

docs: engine authors get a program api page rendered from math_spec.program, and the per-module pages and the file-and-program page are gone - #697

Merged
FBumann merged 2 commits into
claude/docs-expand-model-writer-apifrom
claude/docs-program-page
Sep 25, 2026
Merged

FBumann merged 2 commits into
claude/docs-expand-model-writer-apifrom
claude/docs-program-page

Conversation

@FBumann

@FBumann FBumann commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

Prompt: Building on mathspec should cover the Program side I would say. How to split the Python api for modelers and engine writers is the question...Also if we should even do docs for engine writers... They can read the source code

Note

The following content was generated by AI.

Later prompts that set scope: "Dont fold it into the big PR. Put it into the stack!", then "classes of a loaded model ? What is "model" use for in our package? Is it consistent?" and "Do it".

What this changes

Building on math-spec is the program side only. It holds reading.md, a new Program API page rendered from math_spec.program, and what counts as language. The per-module pages are gone, and so is file-and-program.md. "Model" now means only the problem a file states, and the Python objects are called Spec and Program.

Method, gate output, alternatives

Why

Engine authors need the program's contract, which the docstrings state, not a page per internal module. "A loaded model" named neither object a tool gets.

🤖 Generated with Claude Code

https://claude.ai/code/session_01A89tReSh8rTBG9ocy7688y

…rogram, and the per-module pages and the file-and-program page are gone

Building on math-spec now holds reading.md, a Program API page that renders
every name math_spec.program exports, and what counts as language. The why
and the tool table from file-and-program.md move into reading.md's opening,
and the page is deleted. docs/static/hooks.py no longer generates one page
per module: an internal module is read in the source. The docs-writing skill
and the nav comment say so.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A89tReSh8rTBG9ocy7688y
@FBumann
FBumann added this pull request to stack #684 September 25, 2026 06:53
…the python objects are named spec and program

"Reading a loaded model" is now "Reading a spec and its program", in the
title, the nav and every link. The API page says math_spec.program holds the
classes a Program is made of. The glossary opens with a Model entry: the
problem a file states, which holds no data. The README and the typeset
docstring name Spec and Program where they said the model or a loaded model.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01A89tReSh8rTBG9ocy7688y
@FBumann
FBumann merged commit 784867a into main Sep 25, 2026
6 checks passed
FBumann added a commit to fluxopt/specsolve that referenced this pull request Sep 25, 2026
…word, and every link into math-spec's docs resolves (#1740)

> **Prompt:** classes of a loaded model ? What is "model" use for in our
package? Is it consistent?

> [!NOTE]
> The following content was generated by AI.

Later prompts that set scope: "Do it", then "Check if the specsolve PR
has correct links! mathspec changed its docs a bit!"

The glossary now defines a model as math-spec does: the problem a spec
states, with no data. `specsolve.Model` is that model with data
attached. All 85 links into math-spec's docs resolve on its current
site. Before this PR, 20 of the 48 distinct URLs were broken.

<details><summary>Method, gate output, alternatives</summary>

**Glossary** (`docs/reference/glossary.md`):
- The opening line now reads: "A **spec** is the model you write: the
math, with no data. A **`Model`** is that model with your data
attached."
- The **Model** entry says the word is math-spec's, and
`specsolve.Model` is that model with data attached.
- The matching change in math-spec is energy-models/mathspec#697.

**Links.** math-spec's `main` now holds the merged docs restructure, and
#568 moved its site to zensical. I built that site locally from `main`
with zensical and checked every `math-spec.readthedocs.io` URL in this
repository against its pages and element ids.
- **Ladder pages, 16 links:** they linked `examples/pypsa/#rung-N`. The
rungs are headed `rung-N--<name>`, and rungs 10 and 12–15 have a page of
their own. The names differ from this ladder's (`multi-link`, not
`multilink`), so they cannot be derived. `tools/ladder.py` now holds a
`CORPUS_RUNGS` table from rung to page and anchor, and the 16 pages are
regenerated. The regeneration changes one line per page.
- **Hand-written links:**

  | Old target | New target |
  |---|---|
| `about/limits/#solver-capability` (4) |
`about/what-counts-as-language/#what-each-tool-decides-for-itself` |
| `reference/language/expressions/#named-expressions` (3) |
`reference/language/named/#expressions` |
| `reference/language/dimensions/#relations` (2),
`#how-the-map-is-supplied` | `reference/language/relations/`,
`#the-data-contract` |
|
`reference/language/absence/#a-row-with-no-variable-terms-is-not-built`
| `#rows-with-no-variable-terms` |
| `reference/language/piecewise/#lp-the-one-that-declares-nothing` |
`#method` |
  | `reference/language/reading/…` (3) | `reference/reading/…` |

One link's text quoted the old heading, "Capability is not the ceiling".
It now reads "what each tool decides for itself".

**Gates** (pixi is not installable in this session; a Python 3.12 venv
with `pip install -e .` stood in):
- `python -m tools.ladder --check`: exit 0.
- `pytest tests/test_pypsa_ladder_page.py tests/test_docs_math.py
tests/test_docs_site.py tests/test_doc_examples.py`: 200 passed, 73
skipped (the docs group is skipped in the default environment).
- `ruff check` and `ruff format --check` (0.16.1) on `tools/ladder.py`:
clean.
- Link check: 85 links, 0 broken.
- Not run: `pixi run check`, the full suite, the docs build.

**Not done:**
- `specsolve.Model` is not renamed.
- The `CORPUS_RUNGS` table breaks again if math-spec renames a rung
heading. A test that asks math-spec's built site would catch that, but
this PR does not add one.

</details>

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01A89tReSh8rTBG9ocy7688y

---------

Co-authored-by: Claude <noreply@anthropic.com>
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