Skip to content

Conversation

@tobiasdiez
Copy link
Contributor

Migrate the shell script doc/bootstrap to Python. This improves performance and is preparation for building the docs simply by running "sphinx", see #41156.

The output should be more or less equivalent, expect for minor formatting changes and better escaping of the generated shell commands.

📝 Checklist

  • The title is concise and informative.
  • The description explains in detail what this PR is about.
  • I have linked a relevant issue or discussion.
  • I have created tests covering the changes.
  • I have updated the documentation and checked the documentation preview.

⌛ Dependencies

@github-actions
Copy link

github-actions bot commented Nov 11, 2025

Documentation preview for this PR (built with commit dc56c2a; changes) is ready! 🎉
This preview will update shortly after each push to this PR.

@tobiasdiez tobiasdiez marked this pull request as ready for review November 11, 2025 15:34
@mantepse
Copy link
Contributor

I have no idea how I could help in the reviewing process here. Any hints welcome! (I don't understand shell scripts)

The changes in package.py are purely cosmetic, with the exception of adding read_system_packages, right? (I admit that I almost dislike all of them - with the exception of replacing ' with ", which I don't care about. I find breaking the lines in this way makes the code less readable)

@antonio-rojas
Copy link
Contributor

Doesn't build here

FAILED: [code=1] src/doc/htmlspkg 
/usr/bin/python /build/sagemath-doc-git/src/sage/src/build-docs.py --no-prune-empty-dirs --no-pdf-links reference/spkg html -o src/doc --source /build/sagemath-doc-git/src/build/src/doc
[spkg     ] inventory <https://ipywidgets.readthedocs.io/en/stable/> contains multiple definitions for std:label:examples/Widget Layout.ipynb#display
[spkg     ] building [html]: targets for 467 source files that are out of date
[spkg     ] updating environment: 0 added, 31 changed, 0 removed
[spkg     ] /build/sagemath-doc-git/src/build/src/doc/en/reference/spkg/sagemath_objects.rst:64: WARNING: undefined label: 'spkg_force' [ref.ref]
[spkg     ] The HTML pages are in src/doc/html/en/reference/spkg.
Error building the documentation.
Traceback (most recent call last):
  File "/build/sagemath-doc-git/src/sage/src/build-docs.py", line 11, in <module>
    main()
    ~~~~^^
  File "/build/sagemath-doc-git/src/sage/src/sage_docbuild/__main__.py", line 548, in main
    build()
    ~~~~~^^
  File "/build/sagemath-doc-git/src/sage/src/sage_docbuild/builders.py", line 669, in _wrapper
    getattr(DocBuilder, build_type)(self, *args, **kwds)
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
  File "/build/sagemath-doc-git/src/sage/src/sage_docbuild/builders.py", line 142, in f
    runsphinx()
    ~~~~~~~~~^^
  File "/build/sagemath-doc-git/src/sage/src/sage_docbuild/sphinxbuild.py", line 325, in runsphinx
    sys.stderr.raise_errors()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "/build/sagemath-doc-git/src/sage/src/sage_docbuild/sphinxbuild.py", line 256, in raise_errors
    raise OSError(self._error)
OSError: /build/sagemath-doc-git/src/build/src/doc/en/reference/spkg/sagemath_objects.rst:64: WARNING: undefined label: 'spkg_force' [ref.ref]

@tobiasdiez
Copy link
Contributor Author

I thought that was fixed already with f71e2e6. Strange... I don't have time atm, but will look at it end of next week.

@antonio-rojas
Copy link
Contributor

Looks like the bootstrap.py→bootstrap-docs.py rename somehow confuses github, and it generates an invalid patch that doesn't apply correctly. I built directly from your branch and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants