Skip to content

One page per function / class in HTML docs for skimage2 - #8154

Merged
stefanv merged 4 commits into
scikit-image:mainfrom
blink1073:function-per-page-docs
May 19, 2026
Merged

stefanv merged 4 commits into
scikit-image:mainfrom
blink1073:function-per-page-docs

Conversation

@blink1073

@blink1073 blink1073 commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Closes #8148

This PR enables one-page-per-function API documentation in the skimage2 namespace, following the pattern used by NumPy. It also enforces that each function or class has an examples section.

Changes

One page per function/class for skimage2 docs

  • Added per_function_pages=False parameter to ApiDocWriter in doc/tools/apigen.py. When True, the generated module page emits .. autosummary:: :toctree: . instead of inline .. autofunction:: /
    .. autoclass:: blocks, delegating per-member page generation to Sphinx's native autosummary machinery.
  • Added doc/source/_templates/autosummary/function.rst and class.rst — Jinja2 templates (NumPy-style) that define the layout of each per-function and per-class page, including the minigallery directive.
  • Updated doc/tools/build_modref_templates.py to pass per_function_pages=True for the skimage2 docwriter only. The skimage (v1) docs are unchanged.

The resulting per-function pages will have stable URLs of the form api2/skimage2.color.combine_stains.html, consistent with the flat api2/ directory layout.

Warn on missing Examples sections in skimage2 docstrings

  • Added a check_examples_section handler in doc/ext/skimage_extensions.py connected to the autodoc-process-docstring Sphinx event. For every public function or class in the skimage2 namespace, it
    checks whether numpydoc has emitted a .. rubric:: Examples section. If not, a Sphinx warning is raised.

AI Usage

This PR was developed with the assistance of Claude Code (claude-sonnet-4-6).
I (@blink1073) have thoroughly reviewed the changes.

@blink1073
blink1073 requested a review from lagru May 8, 2026 19:37
@blink1073 blink1073 added 📄 type: Documentation Updates, fixes and additions to documentation 🤖 type: Infrastructure CI, packaging, tools and automation 🥾 Path to skimage2 A step towards the new "API 2.0" labels May 8, 2026
@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Reviews (1): Last reviewed commit: "only target functions" | Re-trigger Greptile

Comment thread doc/ext/skimage_extensions.py Resolved
Comment thread doc/tools/apigen.py Resolved
@greptile-apps

greptile-apps Bot commented May 8, 2026

Copy link
Copy Markdown
Contributor

Reviews (2): Last reviewed commit: "address greptile review" | Re-trigger Greptile

@lagru lagru removed the 🤖 type: Infrastructure CI, packaging, tools and automation label May 12, 2026
@stefanv

stefanv commented May 19, 2026

Copy link
Copy Markdown
Member

Do we require examples on each function? Not a problem, but also not sure we used to do this.

@stefanv
stefanv merged commit 0da9c81 into scikit-image:main May 19, 2026
28 checks passed
@stefanv stefanv added this to the 0.27 milestone May 19, 2026
@blink1073

Copy link
Copy Markdown
Contributor Author

Do we require examples on each function?

No, I added that check because I wanted to see how good the coverage was, and then left it to preserve the behavior that was already there.

@blink1073
blink1073 deleted the function-per-page-docs branch May 20, 2026 11:09
matthew-brett added a commit to matthew-brett/scikit-image that referenced this pull request May 21, 2026
* origin/main: (254 commits)
  Refactor, document migration utilities (scikit-image#8184)
  ci: improve handling of pr labels (scikit-image#8169)
  Doctest migration in PRs & on all platforms (scikit-image#8141)
  Update SKIP 4 (import hierarchy, backporting, testing) (scikit-image#8097)
  One page per function / class in HTML docs for skimage2 (scikit-image#8154)
  Pin minimum pytest to 9 (scikit-image#8174)
  docs: make source install instructions more discoverable and add build requirements to top level requirements file (scikit-image#8165)
  Drop `--maxfail=5` from local pytest config (scikit-image#8170)
  Use standard C99 static inline instead of `__inline` (scikit-image#8159)
  Fix structural_similarity win_size / gaussian_weights conflict (scikit-image#8162)
  Unwrap seed refactor (scikit-image#8142)
  ci: Remove llvm build and add ccache support on windows (scikit-image#8164)
  Document warn_external in contributing guide (scikit-image#8163)
  CI: Fix emscripten dependencies and clean up wheel test commands (scikit-image#8147)
  Test only changed subpackages (scikit-image#8103)
  Fix nightlies: update deprecated scipy call, fix underdetermined test
  Fix minkowski distanced invocation for SciPy >= 1.18 (scikit-image#8157)
  Port `structural_similarly` to ski2 (scikit-image#8104)
  make spin build requirement a lower bound (scikit-image#8158)
  Drop Python 3.11 Support (scikit-image#8153)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🥾 Path to skimage2 A step towards the new "API 2.0" 📄 type: Documentation Updates, fixes and additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

One page per function / class in HTML docs for skimage2

3 participants