Skip to content

[MRG] Fix ot.batch docstrings that break the API page - #937

Open
Lbobon wants to merge 1 commit into
PythonOT:masterfrom
Lbobon:doc-fix-batch-docstrings
Open

Lbobon wants to merge 1 commit into
PythonOT:masterfrom
Lbobon:doc-fix-batch-docstrings

Conversation

@Lbobon

@Lbobon Lbobon commented Nov 23, 2026 •

Copy link
Copy Markdown

Summary

Part of #222, starting with ot.batch. Several of its docstrings break the API page: make html-noplot reports 6 docutils errors and 26 warnings for this module.

  • solve_batch and proximal_bregman_log_plan_batch use a Reference heading. numpydoc does not recognise it, so docutils sees a raw section title inside the docstring (ERROR: Unexpected section title) and the reference entries render as plain text.
  • The dicts listed under Returns (tensor_batch, bregman_projection_batch, bregman_log_projection_batch, proximal_bregman_log_plan_batch) start right after "Dictionary containing:" with no blank line, which gives ERROR: Unexpected indentation.
  • solve_sample_batch links to [91] <references-batch-solver>, but that references section only defines [92] (Xie et al., the proximal point method the sentence refers to).

Fix

  • Reference → References, with the entries indented as in the rest of POT, and Example → Examples.
  • A blank line before each Returns dict, so they render as lists.
  • In solve_batch, See Also moves before Examples. Otherwise the See Also parser swallows the .. _references-batch-solver: label and the :ref: links to it break. With the label at the end of Examples, it works the same way as in ot.emd.
  • [91] → [92] in solve_sample_batch.

After the change ot.batch has no errors and 8 warnings, and nothing new appears in other modules apart from the "duplicate label … other instance in all.rst" warning that every module already gets. The 8 left are citation numbers ([2], [12], [92]) defined in several functions on the same page. That affects the whole documentation, so I left it for a separate PR.

Docstring-only change: pre-commit and pytest --doctest-modules ot/batch pass.

@Lbobon Lbobon closed this Nov 23, 2026
- Rename "Reference" to "References" and indent the reference entries
- Add the missing blank line before the dictionaries listed under Returns
- Rename "Example" to "Examples" in proximal_bregman_log_plan_batch
- Move "See Also" before "Examples" in solve_batch so the references label is kept
- Cite [92] instead of the undefined [91] in solve_sample_batch

Part of PythonOT#222.
@Lbobon Lbobon changed the title [MRG] Fix ot.batch docstrings that broke the API page (part of #222) [MRG] Fix ot.batch docstrings that break the API page Nov 23, 2026
@Lbobon Lbobon reopened this Nov 23, 2026
@Lbobon
Lbobon force-pushed the doc-fix-batch-docstrings branch from 5a6153a to 31e14b2 Compare November 23, 2026 16:18

This branch has not been deployed

No deployments
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.

1 participant