Skip to content

Commit 19d18a0

Browse files
authored
Merge pull request #4716 from mwichmann/doc/expand-sphinx
Tweak the API Docs build (Sphinx) configuration [skip appveyor]
2 parents 21b559a + 7037f47 commit 19d18a0

5 files changed

Lines changed: 66 additions & 39 deletions

File tree

CHANGES.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ RELEASE VERSION/DATE TO BE FILLED IN LATER
4040
one from PEP 308 introduced in Python 2.5 (2006). The idiom being
4141
replaced (using and/or) is regarded as error prone.
4242
- Improve the description of PackageVariable.
43+
- Tweak the "API Docs" build (Sphinx) configuration a bit. Some
44+
one-file modules were reported as duplicated, this is fixed.
45+
SConsDoc and SConsExample are now included - their API is
46+
interesting to developers working on SCons (needed to write docs),
47+
even if not part of "The SCons API" itself.
48+
Reworded the API Docs intro sectios a bit.
4349

4450

4551
RELEASE 4.9.1 - Thu, 27 Mar 2025 11:40:20 -0700

RELEASE.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,11 @@ DOCUMENTATION
6464

6565
- Improve the description of PackageVariable.
6666

67+
- The "API Docs" build (Sphinx) configuration is improved, and
68+
SConsDoc and SConsExample are now included - their API is
69+
interesting to developers working on SCons (needed to write docs),
70+
even if not part of "The SCons API" itself.
71+
6772
DEVELOPMENT
6873
-----------
6974

doc/sphinx/SCons.rst

Lines changed: 24 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,6 @@ Module contents
99
:undoc-members:
1010
:show-inheritance:
1111

12-
Subpackages
13-
-----------
14-
15-
.. toctree::
16-
17-
SCons.Node
18-
SCons.Platform
19-
SCons.Scanner
20-
SCons.Script
21-
SCons.Taskmaster
22-
SCons.Tool
23-
SCons.Util
24-
SCons.Variables
25-
SCons.compat
26-
2712
Submodules
2813
----------
2914

@@ -174,3 +159,27 @@ SCons.exitfuncs module
174159
:members:
175160
:undoc-members:
176161
:show-inheritance:
162+
163+
SConsDoc documentation module
164+
-----------------------------
165+
166+
This module is NOT part of the SCons build tool itself.
167+
It is supporting tooling, invoked by tools used to build
168+
documentation components.
169+
170+
.. automodule:: bin.SConsDoc
171+
:members:
172+
:undoc-members:
173+
:show-inheritance:
174+
175+
SConsExamples documentation module
176+
----------------------------------
177+
178+
This module is NOT part of the SCons build tool itself.
179+
It is supporting tooling, invoked by tools used to build
180+
documentation components.
181+
182+
.. automodule:: bin.SConsExamples
183+
:members:
184+
:undoc-members:
185+
:show-inheritance:

doc/sphinx/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@
1818
#
1919
import os
2020
import sys
21+
22+
sys.path.insert(0, os.path.abspath('../../testing/framework'))
23+
sys.path.insert(0, os.path.abspath('../../bin'))
2124
sys.path.insert(0, os.path.abspath('../../'))
2225

2326
# -- General configuration ------------------------------------------------

doc/sphinx/index.rst

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,49 @@
1-
.. SCons documentation master file, originally created by
2-
sphinx-quickstart on Mon Apr 30 09:36:53 2018.
1+
.. SCons documentation master file, originally created by sphinx-quickstart on Mon Apr 30 09:36:53 2018.
32
You can adapt this file completely to your liking, but it should at least
43
contain the root `toctree` directive.
54
65
SCons API Documentation
76
=======================
87

98
.. Attention::
10-
This is the **internal** API Documentation for SCons (aka
11-
"everything"). It is generated automatically from code docstrings using
12-
the `Sphinx <https://www.sphinx-doc.org>`_ documentation generator.
139

14-
Any missing/incomplete information is due to shortcomings in the
15-
docstrings in the code. To not be too flippant about it, filling
16-
in all the docstrings has not always been a priority across the
17-
two-plus decades SCons has been in existence (contributions on this
18-
front are welcomed). Additionally, for SCons classes which inherit
19-
from Python standard library classes (such as ``UserList``,
20-
``UserDict``, ``UserString``), the generated pages will show methods
21-
that are inherited, sometimes with no information at all, sometimes
22-
with a signature/description that seems mangled: Python upstream has
23-
similar limitations as to the quality of dosctrings vs the current
24-
standards Sphinx expects. Inherited interfaces from outside SCons
25-
code can be identified by the lack of a ``[source]`` button to the
26-
right of the method signature.
27-
28-
If you are looking for the Public API - the interfaces that have
10+
This is the **internal** API Documentation for SCons.
11+
It is generated automatically from code docstrings using
12+
the `Sphinx <https://www.sphinx-doc.org>`_ documentation generator,
13+
and covers much more than the Public API.
14+
If you were looking for the Public API - the interfaces that have
2915
long-term consistency guarantees, which you can reliably use when
3016
writing a build system for a project - see the `SCons Reference Manual
3117
<https://scons.org/doc/production/HTML/scons-man.html>`_. Note that
32-
what is Public API and what is not is not clearly delineated in these
33-
API Docs.
18+
what is Public API and what is not is often not clearly delineated in
19+
these API Docs.
3420

35-
The target audience is both developers contributing to SCons itself,
21+
The target audience is developers contributing to SCons itself,
3622
and those writing external Tools, Builders, and other related
3723
functionality for their project, who may need to reach beyond the
3824
Public API to accomplish their tasks. Reaching into internals is fine,
3925
but comes with the usual risks of "things here could change, it's up
4026
to you to keep your code working".
4127

28+
Any missing/incomplete information is due to shortcomings in the
29+
docstrings in the code. Without being flippant, filling
30+
in all the docstrings has not always been a priority across the
31+
two-plus decades SCons has been in existence. Contributions
32+
improving the docstring front are welcome. It is often useful when
33+
making some larger change to fill in docstrings and suitable
34+
type annotations in the code being modified, "leaving the world
35+
a better place", as it were.
36+
37+
Note that the Sphinx configuration is limited, still a work
38+
in progress. SCons classes which inherit from Python standard
39+
library classes (e.g. ``UserList``, ``UserDict``, ``UserString``),
40+
may be allowed to show inherited mmembers; the Python standard library
41+
occasionally has little to no helpful docstring information.
42+
Inherited interfaces from outside SCons code can be identified by the
43+
lack of a ``[source]`` button to the right of the method signature.
44+
Such classes should be evaluated case-by-case and possibly
45+
switched to not show inherited members, depending on which way
46+
seems to provide the more useful result.
4247

4348
.. toctree::
4449
:maxdepth: 2
@@ -55,7 +60,6 @@ SCons API Documentation
5560
SCons.Util
5661
SCons.Variables
5762

58-
5963
Indices and Tables
6064
==================
6165

0 commit comments

Comments
 (0)