module documentation

Convert docspec objects to their pydocspec augmented version.

This converter is supposed to be fully compatible with docspec_python.

Usage:

import pydocspec
from docspec_python import load_python_modules
from pydocspec.converter import convert_docspec_modules
root: pydocspec.TreeRoot = convert_docspec_modules(load_python_modules(...))

TODO: Converter should not crash when calling unstring_annotation or exract_expr.

Function back_convert_modules Convert a list of pydocspec.Module instances into a list of docspec.Module. This the reverse of convert_docspec_modules, this is useful to be able to dump modules to JSON using docspec.dump_module.
Function convert_docspec_modules Convert a list of docspec.Module instances into a list of pydocspec.Module.
Class _BackConverter Converts pydocspec objects back to docspec in order to serialize them.
Class _BackConverterVisitor Undocumented
Class _Converter Converts docspec objects to their pydocspec augmented version.
Class _ConverterVisitor Visit each docspec objects of a module and create their pydocspec augmented counterparts.
Class _EnumMeta Undocumented
Class _SemanticsConverter Undocumented
Function _get_object_by_name Undocumented
Function _nest_docspec_python_modules Reparent modules to their respective parent packages such that we have an actual hiearchy of packages.
Variable _EnumT Undocumented
def back_convert_modules(modules): (source)

Convert a list of pydocspec.Module instances into a list of docspec.Module. This the reverse of convert_docspec_modules, this is useful to be able to dump modules to JSON using docspec.dump_module.

Example:

import json
import docspec
import pydocspec
from pydocspec import converter
root = pydocspec.load_python_modules(...)
docspec_modules = converter.back_convert_modules(root.root_modules)
raw_docspec_json = {'modules': []}
for m in docspec_modules:
    raw_docspec_json['modules'].append(docspec.dump_module(m))
with open('~/.mysoftware/docspec_modules.json', 'w') as f:
    json.dump(raw_docspec_json, f)
Parameters
modules:Sequence[pydocspec.Module]Modules to convert back to docspec.
Returns
Sequence[docspec.Module]Undocumented
def convert_docspec_modules(modules, options=None): (source)

Convert a list of docspec.Module instances into a list of pydocspec.Module.

Parameters
modules:Iterable[docspec.Module]Modules to convert.
options:Optional[pydocspec.Options]Undocumented
Returns
pydocspec.TreeRootThe TreeRoot instance.
Note
It will transform the tree such that we have an actual hiearchy of packages.
def _get_object_by_name(relativeroots, name): (source)

Undocumented

Parameters
relativeroots:Iterable[docspec.ApiObject]Undocumented
name:dottedname.DottedNameUndocumented
Returns
Optional[docspec.ApiObject]Undocumented
def _nest_docspec_python_modules(modules): (source)

Reparent modules to their respective parent packages such that we have an actual hiearchy of packages.

Parameters
modules:Iterable[docspec.Module]Undocumented
Returns
List[docspec.Module]Undocumented
_EnumT = (source)

Undocumented