Show More
@@ -1,64 +1,64 b'' | |||||
1 | #!/usr/bin/env python |
|
1 | #!/usr/bin/env python | |
2 | """Script to auto-generate our API docs. |
|
2 | """Script to auto-generate our API docs. | |
3 | """ |
|
3 | """ | |
4 | # stdlib imports |
|
4 | # stdlib imports | |
5 | import os |
|
5 | import os | |
6 | import sys |
|
6 | import sys | |
7 |
|
7 | |||
8 | # local imports |
|
8 | # local imports | |
9 | sys.path.append(os.path.abspath('sphinxext')) |
|
9 | sys.path.append(os.path.abspath('sphinxext')) | |
10 | from apigen import ApiDocWriter |
|
10 | from apigen import ApiDocWriter | |
11 |
|
11 | |||
12 | #***************************************************************************** |
|
12 | #***************************************************************************** | |
13 | if __name__ == '__main__': |
|
13 | if __name__ == '__main__': | |
14 | pjoin = os.path.join |
|
14 | pjoin = os.path.join | |
15 | package = 'IPython' |
|
15 | package = 'IPython' | |
16 | outdir = pjoin('source','api','generated') |
|
16 | outdir = pjoin('source','api','generated') | |
17 | docwriter = ApiDocWriter(package,rst_extension='.rst') |
|
17 | docwriter = ApiDocWriter(package,rst_extension='.rst') | |
18 | # You have to escape the . here because . is a special char for regexps. |
|
18 | # You have to escape the . here because . is a special char for regexps. | |
19 | # You must do make clean if you change this! |
|
19 | # You must do make clean if you change this! | |
20 | docwriter.package_skip_patterns += [r'\.external$', |
|
20 | docwriter.package_skip_patterns += [r'\.external$', | |
21 | # Extensions are documented elsewhere. |
|
21 | # Extensions are documented elsewhere. | |
22 | r'\.extensions', |
|
22 | r'\.extensions', | |
23 | r'\.config\.profile', |
|
23 | r'\.config\.profile', | |
24 | # These should be accessed via nbformat.current |
|
24 | # These should be accessed via nbformat.current | |
25 | r'\.nbformat\.v\d+', |
|
25 | r'\.nbformat\.v\d+', | |
26 | ] |
|
26 | ] | |
27 |
|
27 | |||
28 | # The inputhook* modules often cause problems on import, such as trying to |
|
28 | # The inputhook* modules often cause problems on import, such as trying to | |
29 | # load incompatible Qt bindings. It's easiest to leave them all out. The |
|
29 | # load incompatible Qt bindings. It's easiest to leave them all out. The | |
30 | # main API is in the inputhook module, which is documented. |
|
30 | # main API is in the inputhook module, which is documented. | |
31 | docwriter.module_skip_patterns += [ r'\.lib\.inputhook.+', |
|
31 | docwriter.module_skip_patterns += [ r'\.lib\.inputhook.+', | |
32 | r'\.ipdoctest', |
|
32 | r'\.ipdoctest', | |
33 | r'\.testing\.plugin', |
|
33 | r'\.testing\.plugin', | |
34 | # This just prints a deprecation msg: |
|
34 | # This just prints a deprecation msg: | |
35 | r'\.frontend$', |
|
35 | r'\.frontend$', | |
36 | # Deprecated: |
|
36 | # Deprecated: | |
37 | r'\.core\.magics\.deprecated' |
|
37 | r'\.core\.magics\.deprecated', | |
38 | # We document this manually. |
|
38 | # We document this manually. | |
39 | r'\.utils\.py3compat', |
|
39 | r'\.utils\.py3compat', | |
40 | # These are exposed by nbformat.current |
|
40 | # These are exposed by nbformat.current | |
41 | r'\.nbformat\.convert', |
|
41 | r'\.nbformat\.convert', | |
42 | r'\.nbformat\.validator', |
|
42 | r'\.nbformat\.validator', | |
43 | # These are exposed in display |
|
43 | # These are exposed in display | |
44 | r'\.core\.display', |
|
44 | r'\.core\.display', | |
45 | r'\.lib\.display', |
|
45 | r'\.lib\.display', | |
46 | ] |
|
46 | ] | |
47 |
|
47 | |||
48 | # These modules import functions and classes from other places to expose |
|
48 | # These modules import functions and classes from other places to expose | |
49 | # them as part of the public API. They must have __all__ defined. The |
|
49 | # them as part of the public API. They must have __all__ defined. The | |
50 | # non-API modules they import from should be excluded by the skip patterns |
|
50 | # non-API modules they import from should be excluded by the skip patterns | |
51 | # above. |
|
51 | # above. | |
52 | docwriter.names_from__all__.update({ |
|
52 | docwriter.names_from__all__.update({ | |
53 | 'IPython.nbformat.current', |
|
53 | 'IPython.nbformat.current', | |
54 | 'IPython.display', |
|
54 | 'IPython.display', | |
55 | }) |
|
55 | }) | |
56 |
|
56 | |||
57 | # Now, generate the outputs |
|
57 | # Now, generate the outputs | |
58 | docwriter.write_api_docs(outdir) |
|
58 | docwriter.write_api_docs(outdir) | |
59 | # Write index with .txt extension - we can include it, but Sphinx won't try |
|
59 | # Write index with .txt extension - we can include it, but Sphinx won't try | |
60 | # to compile it |
|
60 | # to compile it | |
61 | docwriter.write_index(outdir, 'gen.txt', |
|
61 | docwriter.write_index(outdir, 'gen.txt', | |
62 | relative_to = pjoin('source','api') |
|
62 | relative_to = pjoin('source','api') | |
63 | ) |
|
63 | ) | |
64 | print ('%d files written' % len(docwriter.written_modules)) |
|
64 | print ('%d files written' % len(docwriter.written_modules)) |
General Comments 0
You need to be logged in to leave comments.
Login now