Skip to content

Commit 2766dde

Browse files
try autosummary way
1 parent 5fd62fc commit 2766dde

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

doc/make.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def _generate_exclude_pattern(include_api=True, single_doc=None):
6767
return exclude_patterns
6868

6969

70-
def _write_temp_file(classtype, module, function):
70+
def _write_temp_file2(classtype, module, function):
7171

7272
s = """{1}.{2}
7373
=================================
@@ -80,6 +80,22 @@ def _write_temp_file(classtype, module, function):
8080
f.write(s)
8181

8282

83+
def _write_temp_file(classtype, module, function):
84+
85+
s = """API docs
86+
========
87+
88+
.. autosummary::
89+
:toctree: generated_temp/
90+
91+
{0}.{1}
92+
93+
""".format(module, function)
94+
95+
with open(os.path.join(SOURCE_PATH, "temp.rst"), 'w') as f:
96+
f.write(s)
97+
98+
8399
@contextmanager
84100
def _maybe_exclude_notebooks():
85101
"""Skip building the notebooks if pandoc is not installed.
@@ -242,7 +258,8 @@ def build_docstring(self):
242258
'-Dexclude_patterns={}'.format(self.exclude_patterns),
243259
SOURCE_PATH,
244260
os.path.join(BUILD_PATH, 'html'),
245-
os.path.join(SOURCE_PATH, 'temp.rst')
261+
os.path.join(SOURCE_PATH, 'temp.rst'),
262+
os.path.join(SOURCE_PATH, 'generated_temp/*.rst'),
246263
)
247264
# for some reason it does not work with run_os, but it does if I
248265
# directly call the joined command
@@ -299,7 +316,7 @@ def main():
299316
DocBuilder(args.num_jobs, exclude_patterns).build_docstring()
300317
url = "file://" + os.getcwd() + "/build/html/temp.html"
301318
webbrowser.open(url, new=2)
302-
os.remove('source/temp.rst')
319+
#os.remove('source/temp.rst')
303320

304321
else:
305322
_generate_index(not args.no_api, args.single)

0 commit comments

Comments
 (0)