Skip to content

DOC: Fix Python Sphinx documentation warnings - #1893

Merged
imikejackson merged 1 commit into
BlueQuartzSoftware:developfrom
imikejackson:topic/sphinx_doc_warnings
Oct 29, 2026
Merged

imikejackson merged 1 commit into
BlueQuartzSoftware:developfrom
imikejackson:topic/sphinx_doc_warnings

Conversation

@imikejackson

Copy link
Copy Markdown
Contributor

Summary

The Python Sphinx documentation build gives 9 warnings on the Windows CI (and on macOS). This PR removes all of them. It also makes sphinx-build treat warnings as errors, so that new warnings stop the build.

The cause of most warnings was generate_sphinx_docs.cpp. That tool copies the first paragraph of each filter's ## Description section and each parameter's help text into the .rst files, but its conversion from Markdown to RST was not correct.

Generator changes (wrapping/python/docs/generate_sphinx_docs.cpp)

  • Inline Markdown is now converted with one left-to-right scan. This scan replaces the regular expressions for bold, italic, links and inline code.
    • Inline code (`x`) becomes an RST literal (``x``). Before, it became RST interpreted text, which shows in italics.
    • A link is made only when ]( is adjacent. Before, the text `[-0.5, 0.5]` and a later (Z size 1) became one incorrect link in AdaptiveHistogramEqualizationImageFilter.
    • Bold and italic spans use the shortest match. Unmatched * and ` characters are escaped.
    • When inline markup touches a letter or digit, the scan adds an escaped space. For example, **Data Array**s becomes **Data Array**\ s.
  • List lines are converted one at a time with std::regex_match. Thus the result does not depend on how std::regex anchors work on each platform.
  • The parameter help text is escaped before it goes into the :param: lines. The *User Material text in WriteAbaqusCrystalPlasticityFilter caused 3 warnings.

Other changes

  • conf.py: Remove html_static_path = ['_static']. That folder does not exist.
  • Developer_API.rst: Replace the unknown py:enum directive with py:class. Sphinx 8.2.3 reports this as an error. This directive was added after the CI run that showed the 9 warnings.
  • RandomizeFeatureIdsFilter.md, ComputeBoundingBoxStatsFilter.md, ComputeKMeansFilter.md and ComputeKMedoidsFilter.md: Remove nested bold and italic markup (***WARNING:** ...*). RST cannot nest inline markup. The words did not change.
  • Makefile.in and make.bat.in: Run sphinx-build with -W --keep-going. When the build fails, the script prints sphinx_build_output.log and returns the error status. Thus the CI log shows the warnings.

Test Plan

  • Build the sphinx_docs_generation target in the ci-macos-arm64 build. The result is build succeeded. with 0 warnings.
  • Put back the py:enum directive. The target fails, and the log shows the error.
  • Compare the generated filter summaries before and after the change. Code literals, Data Array plurals and the restored link text show correctly.
  • Escaped _ characters in a link URL make the correct href.
  • clang-format 19.1.1 gives no changes.
  • The Windows CI builds the documentation with 0 warnings. The changes to make.bat.in were not run on Windows before this PR.

Related Issue

  • This PR has no related issue

@imikejackson imikejackson self-assigned this Oct 28, 2026

@jmarquisbq jmarquisbq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed simplnx PR #1893 at commit e7c64781ff145a9e7511baa2e2f8e057fd2f6473. Coverage includes all nine changed files, the generator callers, and documentation build wiring. No blocking findings were found.

Verification completed:

  • The extracted converter functions were compiled with MSVC in a Debug build. Docutils parsed all 311 repository summaries without warnings. Comparison with the base revision and CommonMark found no new text regressions.
  • Focused assertions checked inline literals, links, plural suffixes, and parameter escaping against the parsed output.
  • Native Windows CTest probes used the configured batch template with Sphinx 8.2.3. Success, warning, directive-error, help, missing-executable, and path-with-spaces cases passed. Failure cases returned the expected status and printed the diagnostic log.
  • The repository-root clang-format 19.1.1 check, comment audit, and diff whitespace check passed.

Validation limits:

  • clang-tidy 19.1.5 analyzed extracted converter functions and reported naming, recursion, and style/performance diagnostics. This was not a full-file passing analysis. No material resource issue was found for the short documentation inputs.
  • Linux and macOS CI passed. Windows CI stopped on a test-data download timeout before documentation generation. The complete Windows documentation target remains unverified.
  • Existing converter limitations with adjacent inline spans and repeated link labels remain. Neither occurs in the current summaries.
  • Out-of-core storage and numerical V&V checks do not apply to this documentation change.

APPROVE for the reviewed scope, with the validation limits above.

…rrors

* Convert inline Markdown in filter summaries with one left-to-right
  scan. Inline code becomes an RST literal. A link is made only when
  "](" is adjacent. Bold and italic spans use the shortest match.
  Unmatched markers are escaped.
* Add an escaped space when inline markup touches a letter or digit,
  for example "**Data Array**\ s".
* Convert list lines one at a time with std::regex_match, so that the
  result does not depend on the std::regex anchor behavior of the
  platform.
* Escape RST special characters in the parameter help text.
* Remove the html_static_path entry for the missing _static folder.
* Replace the unknown py:enum directive in Developer_API.rst.
* Remove nested bold and italic markup from four filter documents,
  because RST cannot nest inline markup.
* Run sphinx-build with "-W --keep-going". Print the log and return
  the error status when the build fails, on Unix and on Windows.

Signed-off-by: Michael Jackson <mike.jackson@bluequartz.net>
@imikejackson
imikejackson force-pushed the topic/sphinx_doc_warnings branch from e7c6478 to 70d2d62 Compare October 29, 2026 21:10
@imikejackson
imikejackson enabled auto-merge (squash) October 29, 2026 21:10
@imikejackson
imikejackson merged commit f58acc1 into BlueQuartzSoftware:develop Oct 29, 2026
5 checks passed
@imikejackson
imikejackson deleted the topic/sphinx_doc_warnings branch October 30, 2026 12:57
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