Skip to content

Commit 514962b

Browse files
authored
Use recursive autosummary (glotaran#403)
* Updated needed dependencies * Updated module template to use autosummary's new recursive option * Removed now obsolete api-codcs-up-to-date CI test and removed old api building part * Removed now obsolete files * Fixed broken citation error * Added doc artifact upload * Explicitly set the template for class attributes since autosummary didn't pick it up * Removed now obsolete api generation hack artifacts
1 parent 3c1c4ae commit 514962b

File tree

14 files changed

+91
-448
lines changed

14 files changed

+91
-448
lines changed

.github/workflows/CI_CD_actions.yml

Lines changed: 5 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,12 @@ jobs:
3636
run: pip freeze
3737
- name: Build docs
3838
run: |
39-
python docs/source/generate_api_doc.py
4039
make --directory=docs clean html
40+
- name: Upload docs artifact
41+
uses: actions/upload-artifact@v2
42+
with:
43+
name: docs
44+
path: docs/build/html
4145

4246
docs-links:
4347
runs-on: ubuntu-latest
@@ -56,37 +60,12 @@ jobs:
5660
run: pip freeze
5761
- name: Check doc links
5862
run: |
59-
python docs/source/generate_api_doc.py
6063
make --directory=docs clean linkcheck $@ | tee linkcheck-output.txt
6164
exit ${PIPESTATUS[0]}
6265
- name: Linkcheck summary
6366
if: ${{ always() }}
6467
run: cat linkcheck-output.txt | grep -E "(\(line.*\)|writing output)"
6568

66-
api-docs-up-to-date:
67-
runs-on: ubuntu-latest
68-
needs: [test]
69-
steps:
70-
- uses: actions/checkout@v2
71-
- name: Set up Python 3.7
72-
uses: actions/setup-python@v1
73-
with:
74-
python-version: 3.7
75-
- name: Install dependencies
76-
run: |
77-
python -m pip install -U pip
78-
pip install .
79-
- name: Show installed packages
80-
run: pip freeze
81-
- name: Check if api docs are outdated
82-
run: |
83-
mv docs/source/user_documentation/api_documentation.rst current_api_docs.rst
84-
python docs/source/generate_api_doc.py
85-
diff -qywBd current_api_docs.rst docs/source/user_documentation/api_documentation.rst
86-
- name: Fix instructions
87-
if: failure()
88-
run: echo run 'python docs/source/generate_api_doc.py' locally to fix this issue
89-
9069
test:
9170
runs-on: ${{ matrix.os }}
9271
needs: lint

docs/Makefile

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ clean:
3535
rm -rf $(BUILDDIR)/*
3636
rm -rf $(API_TOCTREE_DIR)/*
3737

38-
api_doc:
39-
$(PYTHON_TO_USE) $(SOURCEDIR)/generate_api_doc.py
40-
4138
# Catch-all target: route all unknown targets to Sphinx using the new
4239
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
4340
%: Makefile

docs/source/_templates/api_documentation_template.rst

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{{ name | escape | underline }}
2+
3+
.. autoattribute:: {{ fullname }}
4+
:noindex:
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{{ name | escape | underline}}
2+
3+
.. currentmodule:: {{ module }}
4+
5+
.. auto{{ objtype }}:: {{ objname }}

docs/source/_templates/autosummary/class.rst

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,40 +14,39 @@
1414
.. rubric:: Attributes Summary
1515

1616
.. autosummary::
17-
:toctree:
17+
:toctree:
18+
:template: autosummary/attribute.rst
1819
{% for item in attributes %}
1920
~{{name}}.{{ item }}
2021
{%- endfor %}
2122

2223
{% endif %}
2324
{% endblock %}
2425

25-
{% if '__init__' in methods %}
26-
{% set caught_result = methods.remove('__init__') %}
27-
{% endif %}
28-
2926

3027
{% block methods_summary %}
3128
{% if methods %}
3229

3330
.. rubric:: Methods Summary
3431

3532
.. autosummary::
36-
:toctree:
33+
:toctree:
3734
:nosignatures:
3835

3936
{% for item in methods %}
37+
{% if not item.endswith("__init__") %}
4038
~{{ name }}.{{ item }}
39+
{% endif %}
4140
{%- endfor %}
4241

43-
{% block methods_documentation %}
44-
{% if methods %}
45-
46-
.. rubric:: Methods Documentation
4742

4843
{% endif %}
4944
{% endblock %}
5045

46+
{% block methods_documentation %}
47+
{% if methods %}
48+
49+
.. rubric:: Methods Documentation
5150

5251
{% endif %}
5352
{% endblock %}
Lines changed: 63 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,93 @@
1-
{% extends "known_packages.rst" %}
21
{% block module %}
3-
{{ fullname | replace("glotaran.", "") | escape | underline}}
4-
{#{% set reduced_name={child_modules} %}#}
2+
{{ name | escape | underline }}
53

64
.. currentmodule:: {{ module }}
75

86
.. automodule:: {{ fullname }}
97

10-
{% if fullname in known_packages %}
11-
.. rubric:: Submodules
128

13-
.. autosummary::
14-
{% for item in child_modules %}
15-
{% if item.startswith( fullname + ".") %}
16-
{{ item }}
17-
{% endif %}
18-
{%- endfor %}
19-
{% endif %}
209

21-
{% block functions %}
22-
{% if functions %}
10+
{% block modules %}
11+
{% if modules %}
12+
13+
.. rubric:: Modules
14+
15+
.. autosummary::
16+
:toctree: {{ name }}
17+
:recursive:
18+
19+
{% for item in modules %}
20+
{% if not item.endswith("test") %}
21+
{{ item }}
22+
{% endif %}
23+
24+
{%- endfor %}
25+
26+
{% endif %}
27+
28+
{% endblock %}
29+
30+
31+
{% block functions %}
32+
{% if functions %}
2333

2434
Functions
2535
---------
2636

27-
.. rubric:: Summary
37+
.. rubric:: Summary
38+
39+
.. autosummary::
40+
:toctree: {{ name }}
41+
:nosignatures:
2842

29-
.. autosummary::
30-
:toctree: {{ fullname | replace("glotaran.", "") | replace(".", "/") }}/functions
31-
:nosignatures:
32-
{% for item in functions %}
43+
{% for item in functions %}
3344
{{ item }}
34-
{%- endfor %}
35-
{% endif %}
36-
{% endblock %}
45+
{%- endfor %}
3746

38-
{% block classes %}
39-
{% if classes %}
47+
{% endif %}
48+
49+
{% endblock %}
50+
51+
{% block classes %}
52+
{% if classes %}
4053

4154
Classes
4255
-------
4356

44-
.. rubric:: Summary
57+
.. rubric:: Summary
58+
59+
.. autosummary::
60+
:toctree: {{ name }}
61+
:nosignatures:
4562

46-
.. autosummary::
47-
:toctree: {{ fullname | replace("glotaran.", "") | replace(".", "/") }}/classes
48-
:nosignatures:
49-
{% for item in classes %}
63+
{% for item in classes %}
5064
{{ item }}
51-
{%- endfor %}
52-
{% endif %}
53-
{% endblock %}
65+
{%- endfor %}
66+
67+
{% endif %}
68+
69+
{% endblock %}
5470

55-
{% block exceptions %}
56-
{% if exceptions %}
71+
72+
{% block exceptions %}
73+
{% if exceptions %}
5774

5875
Exceptions
5976
----------
6077

61-
.. rubric:: Exception Summary
78+
.. rubric:: Exception Summary
79+
80+
.. autosummary::
81+
:toctree: {{ name }}
82+
:nosignatures:
6283

63-
.. autosummary::
64-
:toctree: {{ fullname | replace("glotaran.", "") | replace(".", "/") }}/exceptions
65-
{% for item in exceptions %}
84+
{% for item in exceptions %}
6685
{{ item }}
67-
{%- endfor %}
68-
{% endif %}
69-
{% endblock %}
86+
{%- endfor %}
87+
88+
{% endif %}
89+
90+
{% endblock %}
7091

7192

72-
{% endblock %}
93+
{% endblock %}

docs/source/_templates/known_packages.rst

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

docs/source/_templates/known_packages_template.rst

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

0 commit comments

Comments
 (0)