:py:`CLASS_INDEX_EXPAND_INNER` Whether to expand inner classes in the
class index. If not set, :py:`False` is
used.
+:py:`NAME_MAPPING: Dict[str, str]` Additional name mapping in addition to
+ what's figured out from the ``__all__``
+ members
:py:`PYBIND11_COMPATIBILITY: bool` Enable some additional tricks for better
compatibility with pybind11. If not set,
:py:`False` is used. See
be a plain module (instead of a package) and since those can't have submodules,
all found submodules in it are ignored.
-.. block-success:: Overriding the set of included names
+.. block-success:: Overriding the set of included names, module reorganization
- In case the autodetection includes more than you want or you need to
- include names from other modules as part of the module you need, you can
- temporarily override the :py:`__all__` attribute when generating the docs.
- For example, the following will list just the :py:`pow()` and :py:`log()`
- funtions from the :py:`math` module, ignoring the rest:
+ In case the autodetection includes more than you want or, conversely, you
+ need to include names that would otherwise be excluded (such as underscored
+ names), you can temporarily override the :py:`__all__` attribute when
+ generating the docs. For example, the following will list just the
+ :py:`pow()` and :py:`log()` funtions from the :py:`math` module, ignoring
+ the rest:
.. code:: py
INPUT_MODULES = [math]
+ In other cases, especially when native modules are involved, the inspected
+ name locations might not be what you want. By putting the names into
+ :py:`__all__` you tell the script it should map the inspected location to
+ the one provided. Note you should also hide the original location from the
+ script to avoid duplicate definitons (unless it's underscored, in which
+ case it'll get ignored automatically).
+
+ .. code:: py
+
+ # module math
+
+ from _native_math import fast_sin as sin
+ from _native_math import fast_cos as cos
+ __all__ = ['sin', 'cos']
+
+ Additionally, for mapping types of external libraries where the
+ autodetection from :py:`__all__` can't be performed, you can use the
+ :py:`NAME_MAPPING` option:
+
+ .. code:: py
+
+ NAME_MAPPING = {
+ 'fastmath._native.Vector3': 'fastmath.Vector3',
+ 'fastmath._native.Quaternion': 'fastmath.Quaternion',
+ # or, equivalently, if the mapping is the same for all members:
+ 'fastmath._native': 'fastmath'
+ }
+
`Docstrings`_
-------------
'CLASS_INDEX_EXPAND_LEVELS': 1,
'CLASS_INDEX_EXPAND_INNER': False,
+ 'NAME_MAPPING': {},
'PYBIND11_COMPATIBILITY': False,
'ATTRS_COMPATIBILITY': False,
class State:
def __init__(self, config):
self.config = config
- self.name_mapping: Dict[str, str] = {}
+ self.name_mapping: Dict[str, str] = copy.deepcopy(config['NAME_MAPPING'])
self.module_docs: Dict[str, Dict[str, str]] = {}
self.class_docs: Dict[str, Dict[str, str]] = {}
self.enum_docs: Dict[str, Dict[str, str]] = {}