diff --git a/docs/conf.py b/docs/conf.py index eecfe672dd..013299285d 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,20 +5,21 @@ https://www.sphinx-doc.org/en/master/usage/configuration.html """ -import os import sys from pathlib import Path from subprocess import check_output +from typing import TypeVar import requests import ophyd_async # Override location of typevars just for sphinx -ophyd_async.core.SignalDatatypeT.__module__ = "ophyd_async.core" +for k in ophyd_async.core.__all__: + v = getattr(ophyd_async.core, k) + if isinstance(v, TypeVar): + v.__module__ = "ophyd_async.core" -# -- General configuration ------------------------------------------------ -sys.path.insert(0, os.path.abspath("../../src")) # General information about the project. project = "ophyd-async" copyright = "2014, Brookhaven National Lab" @@ -81,16 +82,17 @@ # domain name if present. Example entries would be ('py:func', 'int') or # ('envvar', 'LD_LIBRARY_PATH'). nitpick_ignore = [ - # builtins - ("py:class", "NoneType"), - ("py:class", "'str'"), - ("py:class", "'float'"), - ("py:class", "'int'"), - ("py:class", "'bool'"), - ("py:class", "'object'"), - ("py:class", "'id'"), - # typing - ("py:class", "typing_extensions.Literal"), + ("py:class", "ophyd_async.core._utils.T"), + # # builtins + # ("py:class", "NoneType"), + # ("py:class", "'str'"), + # ("py:class", "'float'"), + # ("py:class", "'int'"), + # ("py:class", "'bool'"), + # ("py:class", "'object'"), + # ("py:class", "'id'"), + # # typing + # ("py:class", "typing_extensions.Literal"), ] # Order the members by the order they appear in the source code diff --git a/src/ophyd_async/core/__init__.py b/src/ophyd_async/core/__init__.py index fe95335a8d..fdefacb388 100644 --- a/src/ophyd_async/core/__init__.py +++ b/src/ophyd_async/core/__init__.py @@ -1,4 +1,5 @@ """The building blocks for making devices.""" + from typing import TYPE_CHECKING from ._detector import ( @@ -84,18 +85,18 @@ from ._yaml_settings import YamlSettingsProvider # Docstrings must be added here for sphinx +if not TYPE_CHECKING: + SignalDatatypeT = SignalDatatypeT + """The supported `Signal` datatypes: -SignalDatatypeT = SignalDatatypeT -"""The supported `Signal` datatypes: - -- A python primitive `bool`, `int`, `float`, `str` -- A `StrictEnum` or `SubsetEnum` subclass -- A fixed datatype `Array1D` of numpy bool, signed and unsigned integers or float -- A `np.ndarray` which can change dimensions and datatype at runtime -- A `Sequence` of `str` -- A `Sequence` of `StrictEnum` or `SubsetEnum` subclass -- A `Table` subclass -""" + - A python primitive `bool`, `int`, `float`, `str` + - A `StrictEnum` or `SubsetEnum` subclass + - A fixed datatype `Array1D` of numpy bool, signed and unsigned integers or float + - A `np.ndarray` which can change dimensions and datatype at runtime + - A `Sequence` of `str` + - A `Sequence` of `StrictEnum` or `SubsetEnum` subclass + - A `Table` subclass + """ __all__ = [