Skip to content

Conversation

m-aciek
Copy link
Contributor

@m-aciek m-aciek commented Oct 19, 2025

#133591 introduced an SVG into docs, which is not handled by LaTeX (used for PDF build) natively. This fixes the PDF build error. Uses a recommended approach.

(Better) alternative to #139635.

Render:

Zrzut ekranu 2025-10-19 o 23 58 50

📚 Documentation preview 📚: https://cpython-previews--140342.org.readthedocs.build/

@hugovk
Copy link
Member

hugovk commented Oct 20, 2025

This will install and use the extension for all builds, including HTML and others not building PDFs. Is that intentional?

@m-aciek
Copy link
Contributor Author

m-aciek commented Oct 20, 2025

This will install and use the extension for all builds, including HTML and others not building PDFs. Is that intentional?

The extension is quite lightweight itself, 28.95 KB [1], and skips converting for builders other that LaTeX. I think that it's not worth to introduce handling of optional dependencies for docs builds because of it.

[1]

% uvx --from pypkgsize pkgsize analyze --path Doc/venv --name sphinxcontrib-svg2pdfconverter
Inspecting packages in virtual environment: /Users/m-aciek/projects/cpython/Doc/venv...
Successfully retrieved package data from /Users/maciej.olko/projects/cpython/Doc/venv.
Package Name                   | Version         | Size         | Location
--------------------------------------------------------------------------
sphinxcontrib-svg2pdfconverter | 1.3.0           | 28.95 KB     | /Users/m-aciek/projects/cpython/Doc/venv/lib/python3.13/site-packages

@AA-Turner
Copy link
Member

I'm also unsure about using another third-party extension. Could we not just use the latex customisation features to include the required LaTeX packages?

A

@AA-Turner AA-Turner added the pending The issue will be closed if no feedback is provided label Oct 20, 2025
@m-aciek
Copy link
Contributor Author

m-aciek commented Oct 20, 2025

Could we not just use the latex customisation features to include the required LaTeX packages?

We can include svg package, but replacing \sphinxincludegraphics with \includesvg is more problematic. It would probably require a custom extension? So maybe it would be worth to bring it upstream instead? I don't feel familiar with Sphinx enough and both of those ways seem more problematic then the solution in this PR.

@AA-Turner
Copy link
Member

the solution in this PR

involves bringing in a third-party dependency, who's code we haven't audited, etc. I will point out that until recently, no one had noticed the problem with this particular SVG file, which was added some months ago!

A

@AA-Turner
Copy link
Member

For the avoidance of doubt I'll close this PR, it isn't the right solution.

A

@AA-Turner AA-Turner closed this Oct 20, 2025
@m-aciek m-aciek deleted the gh-139588-docs-pdf-svg branch October 21, 2025 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review pending The issue will be closed if no feedback is provided

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants