Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pip-installable packages sagemath-doc-src, sagemath-doc-inventory, sagemath-doc-html, sagemath-doc-pdf #29868

Open
mkoeppe opened this issue Jun 15, 2020 · 26 comments

Comments

@mkoeppe
Copy link
Member

mkoeppe commented Jun 15, 2020

Similar to #29411 + #29950, which made sagelib a pip-installable distribution (which is then installed by the sage-the-distribution script package sagelib), we change the build/installation scheme of the sage documentation.

We create pip-installable packages sagemath-doc-html and sagemath-doc-pdf. By providing wheels on pypi, users can get access to an offline copy of the documentation without having to build it themselves.

We create a package sagemath-doc-inventory, which is in charge of building and installing the inventory files.
It is a build dependency of sagemath-doc-html and sagemath-doc-pdf.

All of these packages depend on sagemath-doc-src. It has a build-system dependency on sagelib. An sdist of it consists of SAGE_SRC/doc. A wheel of sagemath-doc-src (and thus an installation) contains a copy of the sources (including the auto-generated rst files) in share/doc/sage/src/ and the doctrees in share/doc/sage/doctrees.
The incremental build features of the docbuild will only be active when the package sagemath-doc-src is installed directly using setup.py install, setup.py develop or pip install --editable. In these cases, the doctrees (including environment pickes) are kept in the source directory.
pip wheel will always make a from-scratch build of the documentation, eliminating incremental build errors.

The script sage-grepdoc will be provided by sagemath-doc-html.

Follow-up tickets:

See also:

Depends on #33852

CC: @isuruf @kiwifb @antonio-rojas @timokau @nbruin @dimpase @jhpalmieri @mwageringel @zlscherr

Component: build

Keywords: sd111

Issue created by migration from https://trac.sagemath.org/ticket/29868

@mkoeppe mkoeppe added this to the sage-9.2 milestone Jun 15, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title Make sage docbuild a script package pip-installable packages sage-doc-html, sage-doc-pdf Aug 8, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.2, sage-9.3 Aug 13, 2020
@mkoeppe
Copy link
Member Author

mkoeppe commented Dec 6, 2020

Changed keywords from none to sd111

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title pip-installable packages sage-doc-html, sage-doc-pdf pip-installable packages sagemath-doc-html, sagemath-doc-pdf Dec 9, 2020
@mkoeppe

This comment has been minimized.

@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title pip-installable packages sagemath-doc-html, sagemath-doc-pdf pip-installable packages sagemath-doc-inventory, sagemath-doc-html, sagemath-doc-pdf Feb 6, 2021
@mkoeppe

This comment has been minimized.

@mkoeppe mkoeppe changed the title pip-installable packages sagemath-doc-inventory, sagemath-doc-html, sagemath-doc-pdf pip-installable packages sagemath-doc-src, sagemath-doc-inventory, sagemath-doc-html, sagemath-doc-pdf Feb 6, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 7, 2021

Dependencies: #31356

@mkoeppe
Copy link
Member Author

mkoeppe commented Feb 13, 2021

comment:14

Setting new milestone based on a cursory review of ticket status, priority, and last modification date.

@mkoeppe mkoeppe modified the milestones: sage-9.3, sage-9.4 Feb 13, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Apr 14, 2021

comment:15

Input and help from docbuild experts is very welcome.

@mkoeppe
Copy link
Member Author

mkoeppe commented Apr 15, 2021

comment:16

Some questions:

  • Who generates files such as src/doc/en/reference/monoids/sage/monoids/free_monoid.rst, and should they be part of what sagemath-doc-src installs (and thus ships with the wheel)?

  • Is there a way to only generate the doctrees but not build HTML or PDF?

  • Do the HTML and PDF builds need to be able to run the Sage library, or can they build these formats if given only the doctrees?

@kiwifb
Copy link
Member

kiwifb commented Apr 15, 2021

comment:17

Replying to @mkoeppe:

Some questions:

  • Is there a way to only generate the doctrees but not build HTML or PDF?

I do believe there is a sphinx option for doing just that.

  • Do the HTML and PDF builds need to be able to run the Sage library, or can they build these formats if given only the doctrees?

As far as I know they need to be able to run the sage library. In particular all graphs/plots are generated during the documentation build.

@kiwifb
Copy link
Member

kiwifb commented Apr 15, 2021

comment:18

Replying to @kiwifb:

Replying to @mkoeppe:

Some questions:

  • Is there a way to only generate the doctrees but not build HTML or PDF?

I do believe there is a sphinx option for doing just that.

I cannot find such an option anymore. If it existed. There is an option to say where the doctrees should be stored and found, but nothing on producing it in isolation.

@jhpalmieri
Copy link
Member

comment:19

Well, ./sage --docbuild all inventory builds the inventory files and the doctree files, but not html or pdf.

@jhpalmieri
Copy link
Member

comment:20

Replying to @mkoeppe:

Some questions:

  • Who generates files such as src/doc/en/reference/monoids/sage/monoids/free_monoid.rst, and should they be part of what sagemath-doc-src installs (and thus ships with the wheel)?

The autodoc procedure does this, with sage/monoids/free_monoid.py as input. (Edit: or maybe just src/doc/en/reference/monoids/index.rst as input?) I'm not sure precisely how this is done, but the file sage_docbuild/ext/sage_autodoc.py is certainly relevant. (This is Sage's fork of the Sphinx autodoc module.)

@jhpalmieri
Copy link
Member

comment:21

No, I'm wrong about that. It's done in sage_docbuild/__init__.py, in the write_auto_rest_file method.

@mkoeppe mkoeppe modified the milestones: sage-9.4, sage-9.5 Jul 19, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Nov 9, 2021

Changed dependencies from #31356 to #31356, #32713

@mkoeppe mkoeppe modified the milestones: sage-9.5, sage-9.6 Dec 18, 2021
@mkoeppe
Copy link
Member Author

mkoeppe commented Jan 12, 2022

comment:25

According to #33064 comment:19, there is no need to install doctrees in SAGE_LOCAL, not even for introspection (sage.misc.sphinxify)

@slel

This comment has been minimized.

@mkoeppe mkoeppe modified the milestones: sage-9.6, sage-9.7 Mar 5, 2022
@mkoeppe
Copy link
Member Author

mkoeppe commented May 15, 2022

Changed dependencies from #31356, #32713 to #33852

@mkoeppe

This comment has been minimized.

@kwankyu
Copy link
Collaborator

kwankyu commented Nov 12, 2023

  • Who generates files such as src/doc/en/reference/monoids/sage/monoids/free_monoid.rst,

The autodoc procedure does this, with sage/monoids/free_monoid.py as input. (Edit: or maybe just src/doc/en/reference/monoids/index.rst as input?) I'm not sure precisely how this is done, but the file sage_docbuild/ext/sage_autodoc.py is certainly relevant. (This is Sage's fork of the Sphinx autodoc module.)

No. Reference doc builder (part of Sage, in src/sage_docbuild) is responsible for that, as tangentially explained in #36692 (comment). Then autodoc (extension to Sphinx) is responsible to render the generated rst files. We are shipping sage-specific version of autodoc, but that should be replaced eventually with official autodoc provided by Sphinx

and should they be part of what sagemath-doc-src installs (and thus ships with the wheel)?

Yes, if it intends to include all rst files from which htmls (or pdfs) are generated by Sphinx.

@kwankyu
Copy link
Collaborator

kwankyu commented Nov 12, 2023

comment:21
No, I'm wrong about that. It's done in sage_docbuild/__init__.py, in the write_auto_rest_file method.

Now the builders are in src/sage_docbuild/builders.py.

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

No branches or pull requests

5 participants