|
21 | 21 | from importlib.util import module_from_spec, spec_from_file_location |
22 | 22 |
|
23 | 23 | import pt_lightning_sphinx_theme |
24 | | -from sphinx.ext import apidoc |
25 | 24 |
|
26 | 25 | _PATH_HERE = os.path.abspath(os.path.dirname(__file__)) |
27 | 26 | _PATH_ROOT = os.path.join(_PATH_HERE, '..', '..') |
|
146 | 145 | # directories to ignore when looking for source files. |
147 | 146 | # This pattern also affects html_static_path and html_extra_path. |
148 | 147 | exclude_patterns = [ |
149 | | - 'api/pl_bolts.rst', |
150 | | - 'api/modules.rst', |
151 | | - 'api/pl_bolts.submit.rst', |
152 | | - 'api/pl_bolts.utils.*', |
153 | | - 'api/pl_bolts.info.rst', |
154 | | - 'api/pl_bolts.setup_tools.rst', |
155 | 148 | 'PULL_REQUEST_TEMPLATE.md', |
156 | 149 | ] |
157 | 150 |
|
|
288 | 281 | # sphinx-apidoc for me, since it's easy to forget to regen API docs |
289 | 282 | # and commit them to my repo after making changes to my code. |
290 | 283 |
|
291 | | -# packages for which sphinx-apidoc should generate the docs (.rst files) |
292 | | -PACKAGES = [ |
293 | | - info.__name__, |
294 | | -] |
295 | | - |
296 | | -apidoc_output_folder = os.path.join(_PATH_HERE, 'api') |
297 | | - |
298 | | - |
299 | | -def run_apidoc(_): |
300 | | - sys.path.insert(0, apidoc_output_folder) |
301 | | - |
302 | | - # delete api-doc files before generating them |
303 | | - if os.path.exists(apidoc_output_folder): |
304 | | - shutil.rmtree(apidoc_output_folder) |
305 | | - |
306 | | - for pkg in PACKAGES: |
307 | | - argv = [ |
308 | | - '-e', |
309 | | - '-o', |
310 | | - apidoc_output_folder, |
311 | | - os.path.join(_PATH_ROOT, pkg), |
312 | | - '**/test_*', |
313 | | - '--force', |
314 | | - '--private', |
315 | | - '--module-first', |
316 | | - ] |
317 | | - |
318 | | - apidoc.main(argv) |
319 | | - |
320 | 284 |
|
321 | 285 | def setup(app): |
322 | 286 | # this is for hiding doctest decoration, |
323 | 287 | # see: http://z4r.github.io/python/2011/12/02/hides-the-prompts-and-output/ |
324 | 288 | app.add_js_file('copybutton.js') |
325 | | - app.connect('builder-inited', run_apidoc) |
326 | 289 |
|
327 | 290 |
|
328 | 291 | # copy all notebooks to local folder |
@@ -365,9 +328,6 @@ def package_list_from_file(file): |
365 | 328 |
|
366 | 329 | autodoc_mock_imports = MOCK_PACKAGES |
367 | 330 |
|
368 | | -# for mod_name in MOCK_REQUIRE_PACKAGES: |
369 | | -# sys.modules[mod_name] = mock.Mock() |
370 | | - |
371 | 331 |
|
372 | 332 | # Resolve function |
373 | 333 | # This function is used to populate the (source) links in the API |
@@ -409,6 +369,8 @@ def find_source(): |
409 | 369 | % (github_user, github_repo, filename) |
410 | 370 |
|
411 | 371 |
|
| 372 | +autosummary_generate = True |
| 373 | + |
412 | 374 | autodoc_member_order = 'groupwise' |
413 | 375 | autoclass_content = 'both' |
414 | 376 | # the options are fixed and will be soon in release, |
|
0 commit comments