Skip to content

Commit 4cc014c

Browse files
authored
Merge pull request #286 from ManimCommunity/sphinx-stuff
Sphinx setup: use autosummary to automatically generate module and class pages.
2 parents 7e12020 + 4b4d497 commit 4cc014c

File tree

10 files changed

+79
-37
lines changed

10 files changed

+79
-37
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ coverage.xml
5656
# Sphinx documentation
5757
docs/_build/
5858
docs/build/
59+
docs/source/_autosummary/
5960

6061
# PyBuilder
6162
target/
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{{ fullname | escape | underline }}
2+
3+
.. currentmodule:: {{ fullname }}
4+
5+
.. automodule:: {{ fullname }}
6+
7+
{% block attributes %}
8+
{% if attributes %}
9+
.. rubric:: Module Attributes
10+
11+
.. autosummary::
12+
{% for item in attributes %}
13+
{{ item }}
14+
{%- endfor %}
15+
{% endif %}
16+
{% endblock %}
17+
18+
{% block functions %}
19+
{% if functions %}
20+
.. rubric:: {{ _('Functions') }}
21+
22+
.. autosummary::
23+
{% for item in functions %}
24+
{{ item }}
25+
{%- endfor %}
26+
{% endif %}
27+
{% endblock %}
28+
29+
{% block classes %}
30+
{% if classes %}
31+
.. rubric:: Classes
32+
33+
.. autosummary::
34+
:toctree: .
35+
{% for class in classes %}
36+
{{ class }}
37+
{% endfor %}
38+
39+
{% endif %}
40+
{% endblock %}
41+
42+
{% block exceptions %}
43+
{% if exceptions %}
44+
.. rubric:: {{ _('Exceptions') }}
45+
46+
.. autosummary::
47+
{% for item in exceptions %}
48+
{{ item }}
49+
{%- endfor %}
50+
{% endif %}
51+
{% endblock %}
52+
53+
{% block modules %}
54+
{% if modules %}
55+
.. rubric:: Modules
56+
57+
.. autosummary::
58+
:toctree:
59+
:recursive:
60+
{% for item in modules %}
61+
{{ item }}
62+
{%- endfor %}
63+
{% endif %}
64+
{% endblock %}

docs/source/conf.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,11 @@
3131
'sphinx.ext.autodoc',
3232
'sphinx_rtd_theme',
3333
'recommonmark',
34+
'numpydoc',
3435
]
3536

37+
autosummary_generate = True
38+
3639
# Add any paths that contain templates here, relative to this directory.
3740
templates_path = ['_templates']
3841

docs/source/config.rst

Lines changed: 0 additions & 4 deletions
This file was deleted.

docs/source/constants.rst

Lines changed: 0 additions & 7 deletions
This file was deleted.

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ information here will make it easier for newcomers to get started using
1717

1818

1919
.. toctree::
20-
:maxdepth: 2
20+
:maxdepth: 1
2121
:caption: Documentation
2222

2323
quickstart

docs/source/mobject.rst

Lines changed: 0 additions & 16 deletions
This file was deleted.

docs/source/reference.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,15 @@ Manim Reference
33

44
This reference manual details functions, modules, and objects included in
55
Manim, describing what they are and what they do. For learning how to use
6-
Manim, see the quickstart and tutorial documents.
6+
Manim, see the :doc:`quickstart` and :doc:`tutorial` documents.
77

88

9-
.. toctree::
10-
:maxdepth: 0
9+
.. currentmodule:: manim
1110

12-
mobject
11+
.. autosummary::
12+
:toctree: _autosummary
13+
14+
container.container
15+
mobject.mobject
1316
config
1417
constants

docs/source/tutorial.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Tutorial
2+
13
[NOTE:] this is some text I wrote that was originally meant to be part of the
24
quickstart. However, after some thought I've decided that it's probably a bit
35
too much for the quickstart, as the quickstart document is supposed to showcase

manim/mobject/mobject.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
"""
2-
mobject.py
3-
----------
4-
5-
Base classes for all MObjects.
6-
2+
MObject: Base classes for all mathematical objects.
73
"""
84
from functools import reduce
95
import copy

0 commit comments

Comments
 (0)