Skip to content

Meta-ticket: Sage docbuild #20080

@nthiery

Description

@nthiery

Docbuild tickets:

Sphinx tickets:

See also:


Overview of Sphinx custom code in Sage's documentation build system

The goal of this ticket is to write an overview of the various bits and pieces of custom Sphinx code in Sage, with the long term goal to see which pieces could be:

  • thrown away, using features that are now in Sphinx
  • generalized and submitted upstream
  • cleaned up

Here is a list of files with their relative roles:

src/sage/docs

  • __init__.py: empty file

  • conf.py: standard Sphinx configuration file.

src/sage_docbuild (was src/sage_setup/docbuild)

  • __init__.py: top-level docbuilder, contains classes for the various documents (e.g. reference manual).

  • __main__.py: stub entry point for sage --docbuild, calls main() from __init__.py

  • build_options.py: Parse the option for building.

  • sphinxbuild.py: Sage's version of the sphinx-build script

    mainly deals with logging and error reporting.

src/sage_docbuild/ext (was src/sage_setup/docbuild/ext)

  • inventory_builder.py:

    A customized HTML builder which only generates intersphinx "object.inv"
    inventory files and pickle files. The documentation files are not written.
    This is supposed to be used with multidocs below.

  • multidocs.py:

    The goal of this extension is to manage a multi documentation in Sphinx.
    To be able to compile Sage's huge documentation in parallel, the
    documentation is cut into a bunch of independent documentations called
    "subdocs", which are compiled separately. There is a master document which
    points to all the subdocs. The intersphinx extension ensures that the
    cross-link between the subdocs are correctly resolved. However some work
    is needed to build a global index. This is the goal of multidocs.

    More precisely this extension ensures the correct merging of

      1. the todo list if this extension is activated;
      2. the python indexes;
      3. the list of python modules;
      4. the javascript index;
      5. the citations.
    
  • sage_autodoc.py

    This is a patched version of sphinx.ext.autodoc, which started to diverge
    before 2011. As far as I (Florent) understand, the role here is to

      1. allows to correctly fetch the Cython doc and argspec
      2. get correctly the argspec of callable (from the `_sage_argspec_`
         attribute) #9976
      3. deals correctly with LazyImport #17455
      4. In particular document CachedFunction as a function and not a class
         instance #9976.
      5. correctly handles classe aliases and nested classed #7448 #5986
    

    This file probably need to be completely reworked since Sphinx seems to
    have now various plugin and Mixin.

src/sage/misc

  • sphinxify.py

    script which calls Sphinx to format a single docstring for help from the
    command line or the notebook. Has its own configuration.

CC: @egourgoulhon @jhpalmieri @dimpase @kwankyu @haraldschilly

Component: documentation

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions