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