Skip to content

docs: auto-generated API reference site; remove stale docs (#259) - #308

Open
alecjacobson wants to merge 4 commits into
mainfrom
docs-overhaul
Open

docs: auto-generated API reference site; remove stale docs (#259)#308
alecjacobson wants to merge 4 commits into
mainfrom
docs-overhaul

Conversation

@alecjacobson

Copy link
Copy Markdown
Contributor

Overhauls the Python-bindings documentation. This is Phase 1 of the unified-site plan (Option B): a self-contained, always-current Python docs site, built on the same Material-for-MkDocs stack as libigl.github.io so it can lift-and-shift into that site as a /python/ subtree.

The problem

  • tutorial/igl_docs.md was scraped from the old pybind11 module via pydoc (tutorial/exporter.py) — dead names, >>> examples, wrong signatures.
  • Tutorials mirrored the C++ tutorial and rendered with the unmaintained meshplot → chronic drift.
  • No CI ever deployed the docs (only pip/wheels), so the site rots.

What this does

Removes all of it: tutorial/ (notebooks, igl_docs.md, exporter.py, helpers, 77 legacy images) and the old root mkdocs.yml.

Adds a generated site under website/:

  • generate_api.py — parses the compiled bindings' .pyi type stubs with ast (the reliable signature source for nanobind; tolerant of the invalid signatures nanobind occasionally emits). Renders compact signatures (float64[m, n]), formats doxygen @param/@return docstrings, and cross-links every function with a C++ counterpart to its Doxygen page at libigl.github.io/dox/ (~196/221 core functions link today).
  • mkdocs.yml + landing/install pages on Material, matching libigl.github.io conventions (content tabs, MathJax, emoji icons) so unification is a lift-and-shift.
  • .github/workflows/docs.yml — builds the site on every PR (mkdocs build --strict) and deploys a preview to gh-pages on main. The docs can no longer silently rot.

Generated pages (website/docs/api/) and the built site/ are gitignored; CI regenerates them from the installed package.

Also: a real binding bug

The generator surfaced that circumradius's first argument was bound with an empty name (""_a) — so it couldn't be passed by keyword and produced an invalid stub. Fixed to "V"_a.

Scope note

Per discussion, the tutorial example rewrite is deprioritized (polyscope-based examples can come later, organized as snippets). This PR focuses on the API reference + killing the rot. Phase 2 (wiring this into libigl/libigl.github.io as /python/ with reciprocal C++→Python links) is a follow-up in that repo.

Addresses #259.

🤖 Generated with Claude Code

Horde and others added 4 commits August 11, 2026 13:48
The old documentation was scraped from the *pybind11* era module via pydoc
(tutorial/igl_docs.md, tutorial/exporter.py) and the tutorials mirrored the C++
tutorial and rendered with the unmaintained meshplot — all long stale, and
nothing in CI ever deployed them. Remove them entirely.

Replace with a Material-for-MkDocs site whose API reference is generated
directly from the compiled bindings' .pyi type stubs, so it always matches what
is actually bound:

- website/generate_api.py parses the nanobind stubs with ast (tolerant of the
  invalid signatures nanobind occasionally emits), renders compact signatures
  (e.g. float64[m, n]) and doxygen-style docstrings, and cross-links every
  function that has a C++ counterpart to its page on libigl.github.io/dox.
- website/mkdocs.yml + landing/install pages, on the same Material stack as
  libigl.github.io so this can lift-and-shift into that unified site as a
  /python/ subtree (per-function C++<->Python cross-links already in place).
- .github/workflows/docs.yml builds the site on every PR and deploys a preview
  to gh-pages on main, so it can no longer silently rot.

Generated pages (website/docs/api) and the built site are gitignored; CI
regenerates them. The old contributing guide moves under website/docs.

Also fixes a real binding bug surfaced by the generator: circumradius's first
argument was bound with an empty name (""_a), so it couldn't be passed by
keyword and produced an invalid stub; it is now "V"_a.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Two table-of-contents bugs on the generated API pages:

- libigl's '#V'/'#E'/'#F' ("number of") notation in docstrings was parsed as
  space-less Markdown ATX headings (python-markdown accepts '#heading'),
  injecting stray <h1> entries that polluted the TOC and broke Material's
  nested rendering so the sidebar TOC truncated partway (around 'edges').
  Escape a leading '#' in rendered docstring text.
- The C++ Doxygen cross-link sat inside each function heading, so its text and
  emoji leaked into every TOC entry and the heading anchor slug. Move it to a
  standalone chip line below the heading; cap toc_depth at 3.

The API TOC now lists all functions/classes and no longer shows 'C++'.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The generated C++ links used the wrong Doxygen file-page names and pointed at
non-existent pages:

- Doxygen mangles output filenames: '.h' -> '_8h' and every underscore is
  doubled (marching_cubes.h -> marching__cubes_8h.html). Case is preserved
  (AABB.h -> AABB_8h.html). The generator was using single underscores, so most
  multi-word links 404'd.
- Names that exist in more than one header (e.g. marching_cubes in igl/ and
  igl/copyleft/) get disambiguated by Doxygen into non-derivable names; only
  link names whose header is unique in the tree.
- The deployed /dox/ can lag the bindings' libigl version (new/renamed headers),
  so validate every derived link against the actual Doxygen page list
  (--dox-index, the site's files.html) and drop any that don't exist. Result:
  no 404s. CI fetches files.html and passes it.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The :material-language-cpp: icon is itself a C++ logo, so the chip read
'C++ C++ reference'. Keep just the 'C++ reference' text. (Matches the same fix
in the libigl.github.io site copy.)

Co-Authored-By: Claude Opus 4.8 (1M context) <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.

1 participant