Skip to content

make dist-pdf is broken #139588

Closed
Closed

Activity

  1. AA-Turner commented on Oct 6, 2025

    @AA-Turner
    Member

    @adorilson please wait until we've agreed the correct solution before opening a PR. Are we entirely sure it fixes any problems with SVGs?

    A

  2. m-aciek commented on Oct 15, 2025

    @m-aciek
    Contributor
    • I installed Inkscape,
    • added \usepackage{svg} in 30th line of library.tex,
    • then replaced \sphinxincludegraphics{{heapq-binary-tree}.svg} with \includesvg{{heapq-binary-tree}.svg},
    • then invoked latexmk -f --shell-escape -pdf -dvi- -ps- 'library.tex' (--shell-escape is not in Makefile).

    PDF rendered just fine.

    Feature request in Sphinx: sphinx-doc/sphinx#13953

    Image
  3. StanFromIreland commented on Oct 15, 2025

    @StanFromIreland
    Member

    That sounds like a good solution, thanks for your work on this Maciek!

  4. m-aciek commented on Oct 15, 2025

    @m-aciek
    Contributor

    Jupyter Notebook Tools for Sphinx recommend sphinxcontrib-svg2pdfconverter. This package provides three extensions basing on three different backends. @mgeier recommends rsvg-convert as more lightweight and using less memory than Inkscape one. Also CairoSVG looks promising.

  5. m-aciek commented on Oct 16, 2025

    @m-aciek
    Contributor

    We have quite a few options:

    solutiondetailsproscons
    sphinxcontrib.cairosvgconverterPython libfast, easy to install (Python) = more portablepartial SVG spec coverage
    sphinxcontrib.rsvgconverterlibrsvg: C libfast, broad SVG spec coverageC lib, operating system dependency
    CTAN's svg packageuses Inkscapemost idiomatic (works on LaTeX level); full SVG spec coveragerequires work in Sphinx; Inkscape is slow, dependency-heavy
    sphinxcontrib.inkscapeconverteruses Inkscapefull SVG spec coverageInkscape is slow, dependency-heavy
    sphinx.ext.imgconverteruses Inkscape or librsvgbuilt-in in SphinxImageMagick rasterizes a SVG image on conversion. As a result, the image becomes not scalable.

    I think our SVGs should be easy to convert (not using SVG spec's quirks and edge cases), and CairoSVG would be easier to install as a Python library, available on PyPI. Therefore I personally think that the cairosvgconverter is the best option for us. (update: I've changed my mind, opened a PR with the rsvg) CairoSVG is 8.4 MB, we should make it an optional dependency, to install it only for PDF builds.

  6. m-aciek commented on Oct 19, 2025

    @m-aciek
    Contributor

    For what it's worth, Cairo is not as lightweight as I thought:

    CairoSVG and its dependencies may require additional tools during the installation: a compiler, Python headers, Cairo, and FFI headers. These tools have different names depending on the OS you are using, but:

    • on Windows, you’ll have to install Cairo (with GTK for example) and Visual C++ compiler for Python;
    • on macOS, you’ll have to install cairo and libffi (with Homebrew for example);
    • on Linux, you’ll have to install the cairo, python3-dev and libffi-dev packages (names may vary for your distribution).
  7. m-aciek commented on Oct 21, 2025

    @m-aciek
    Contributor

    For what it's worth, there's another issue impacting stable 3.14 branch, introduced most probably in 9eee7fe (seen in pl lang CI between 5b64b59 and df739f3 commits), caused presumably by high depth of nesting (six levels) in executionmodel.rst:

    | **host machine**
    | **process** (global resources)
    | Python global runtime (*state*)
    | Python interpreter (*state*)
    | **thread** (runs Python bytecode and "C-API")
    | Python thread *state*

    I think that is the cause of ! LaTeX Error: Too deeply nested. in the reference when building the PDF. We can fix it either by setting \setcounter{maxdepth}{6} (?) in the document preamble or by refactoring the docs fragment.

  8. adorilson commented on Oct 21, 2025

    @adorilson
    ContributorAuthor

    For what it's worth, there's another issue impacting stable 3.14 branch,

    This is why I started the issue with "make dist-pdf is raising some errors.".

    What's next? :)

  9. jfbu commented on Oct 26, 2025

    @jfbu
    Contributor

    For what it's worth, there's

    | **host machine**
    | **process** (global resources)
    | Python global runtime (*state*)
    | Python interpreter (*state*)
    | **thread** (runs Python bytecode and "C-API")
    | Python thread *state*

    I think that is the cause of ! LaTeX Error: Too deeply nested. in the reference when building the PDF. We can fix it either by setting \setcounter{maxdepth}{6} (?) in the document preamble or by refactoring the docs fragment.

    Maybe check 'maxlistdepth' key of https://www.sphinx-doc.org/en/master/latex.html#the-latex-elements-configuration-setting

  10. adorilson commented on Oct 28, 2025

    @adorilson
    ContributorAuthor

    We have quite a few options:

    Maybe you could add sphinx.ext.graphviz. It is Python lib and built-in in Sphinx.
    I don't see any obvious cons. Maybe could it be complex?

  11. added a commit that references this issue on Oct 28, 2025
  12. added 2 commits that reference this issue on Oct 28, 2025
  13. added 2 commits that reference this issue on Oct 28, 2025
  14. m-aciek commented on Oct 29, 2025

    @m-aciek
    Contributor

    Back to the SVG topic. Options update:

    solutiondetailsproscons
    adding PDF graph to sources

    sphinx-doc/sphinx#13953 (comment)

    simple, doesn't add docs build-time dependencyadds an extra file to sources

    converting graph to graphviz and using sphinx.ext.graphviz

    #139588 (comment)

    adds Graphviz as docs build-time dependency, requires graph code conversion
    CTAN's svg package

    sphinx-doc/sphinx#13953

    works on LaTeX levelrequires work in Sphinx; depends on Inkscape, requires --shell-escape in latexmk command
    sphinx.ext.imgconverter

    #139635

    built-in in Sphinxdepends on ImageMagick; ImageMagick rasterizes a SVG image on conversion. As a result, the image becomes not scalable.

    We rejected sphinxcontrib-svg2pdfconverter dependency addition not to add a new external dependency.

  15. m-aciek commented on Nov 9, 2025

    @m-aciek
    Contributor

    Every solution other than adding PDF to sources require introducing at least one big third-party build-time dependency.

    Also @jfbu expressed concerns about bringing CTAN's svg package support into Sphinx.

    Another option, not included earlier, would be to pre-generate heapq images from source as a new pre-step for builders, but I think its sophistication is not worth it. It still requires a dependency to convert the PDF to SVG, so it is equivalent to other options requiring dependencies.

    That said, I'd appreciate a review on #140926, which is the implementation on in my opinion the best available option.

  16. m-aciek commented on Nov 10, 2025

    @m-aciek
    Contributor

    With #140926 current main branch builds PDFs (with dist-pdf) just fine. It means that we have no more that those two issues (one fixed, one in progress) related to this GitHub ticket.

  17. added a commit that references this issue on Dec 6, 2025
  18. added a commit that references this issue on Mar 9, 2026
  19. added a commit that references this issue on Mar 10, 2026
  20. added a commit that references this issue on Mar 21, 2026
  21. m-aciek commented on Apr 1, 2026

    @m-aciek
    Contributor

    As far as I'm concerned with #145480 and #145741 this issue is completed.

  22. added a commit that references this issue on Apr 25, 2026
  23. added 2 commits that reference this issue on Jun 11, 2026
  24. added a commit that references this issue on Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions