![]() |
Main entry point for generating docs.
tfdocs.generate_lib.DocGenerator(
*,
root_title: str,
py_modules: Sequence[tuple[str, Any]],
base_dir: Optional[Sequence[Union[str, pathlib.Path]]] = None,
code_url_prefix: Union[Optional[str], Sequence[Optional[str]]] = (),
self_link_base: Optional[str] = None,
search_hints: bool = True,
site_path: str = 'api_docs/python',
private_map: Optional[dict[str, str]] = None,
visitor_cls: Type[tfdocs.doc_generator_visitor.DocGeneratorVisitor
] = tfdocs.doc_generator_visitor.DocGeneratorVisitor
,
api_cache: bool = True,
callbacks: Optional[list[public_api.ApiFilter]] = None,
yaml_toc: Union[bool, Type[toc_lib.TocBuilder]] = True,
gen_redirects: bool = True,
gen_report: bool = True,
extra_docs: Optional[dict[int, str]] = None,
page_builder_classes: Optional[docs_for_object.PageBuilderDict] = None
)
Args | |
---|---|
root_title
|
A string. The main title for the project. Like "TensorFlow" |
py_modules
|
The python module to document. |
base_dir
|
String or tuple of strings. Directories that "Defined in" links
are generated relative to. Modules outside one of these directories
are not documented. No base_dir should be inside another.
|
code_url_prefix
|
String or tuple of strings. The prefix to add to "Defined
in" paths. These are zipped with base-dir , to set the defined_in
path for each file. The defined in link for {base_dir}/path/to/file is
set to {code_url_prefix}/path/to/file .
|
self_link_base
|
A string. A URL prefix pre-pend to self-links to the
generated docs pages. Optional, if no self_link_base is supplied, no
self-link will be added.
|
search_hints
|
Bool. Include metadata search hints at the top of each file. |
site_path
|
Path prefix in the "_toc.yaml" |
private_map
|
DEPRECATED. Use api_generator.doc_controls , or pass a
filter to the callbacks argument. A {"module.path.to.object":
["names"]} dictionary. Specific aliases that should not be shown in the
resulting docs.
|
visitor_cls
|
An option to override the default visitor class
doc_generator_visitor.DocGeneratorVisitor .
|
api_cache
|
Bool. Generate an api_cache file. This is used to easily add
api links for backticked symbols (like tf.add ) in other docs.
|
callbacks
|
Additional callbacks passed to traverse . Executed between the
PublicApiFilter and the accumulator (DocGeneratorVisitor ). The
primary use case for these is to filter the list of children (see:
public_api.ApiFilter for the required signature)
|
yaml_toc
|
Bool which decides whether to generate _toc.yaml file or not. |
gen_redirects
|
Bool which decides whether to generate _redirects.yaml file or not. |
gen_report
|
If True, a report for the library is generated by linting the docstrings of its public API symbols. |
extra_docs
|
To add docs for a particular object instance set it's doc
attribute. For some classes (list, tuple, etc) doc is not writable.
Pass those docs like: extra_docs={id(obj): "docs"}
|
page_builder_classes
|
An optional dict of {ObjectType:Type[PageInfo]}
for overriding the default page builder classes.
|
Methods
build
build(
output_dir
)
Build all the docs.
This produces python api docs:
- generated from
py_module
. - written to '{output_dir}/api_docs/python/'
Args | |
---|---|
output_dir
|
Where to write the resulting docs. |
make_default_filters
make_default_filters() -> list[public_api.ApiFilter]
make_parser_config
make_parser_config(
visitor: tfdocs.doc_generator_visitor.DocGeneratorVisitor
)
make_reference_resolver
make_reference_resolver(
visitor
)
run_extraction
run_extraction() -> config.ParserConfig
Walks the module contents, returns an index of all visited objects.
Returns | |
---|---|
An instance of parser_config.ParserConfig .
|