-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Current status:
- Imports of public classes are using the technique described in Hide private submodules from documentation #16 (comment) .
- Imports of TypeVars and TypeAliases are not.
classmethod from_array_1d(array: numpy.typing.NDArray[_TOtherRaw], dtype: None = ..., *, copy: bool = ..., start_index: SupportsIndex | None = ..., sample_count: SupportsIndex | None = ..., extended_properties: collections.abc.Mapping[str, nitypes.waveform.ExtendedPropertyValue] | None = ..., timing: nitypes.waveform.Timing[nitypes.waveform._timing._AnyDateTime, nitypes.waveform._timing._AnyTimeDelta, nitypes.waveform._timing._AnyTimeDelta] | None = ..., scale_mode: nitypes.waveform.ScaleMode | None = ...)→ AnalogWaveform[_TOtherRaw]
nitypes.waveform.ExtendedPropertyValue, nitypes.waveform.Timing, and nitypes.waveform.ScaleMode are the public exports.
nitypes.waveform._timing._AnyDateTime and nitypes.waveform._timing._AnyTimeDelta are TypeAliases in a private submodule.
_TOtherRaw is a TypeVar in a private submodule. Sphinx-autoapi is not displaying its submodule name here, but I think there may be some situations where it does.
After discussion with @mshafer-NI, I think it makes sense to do the following:
- Make TypeAliases (e.g.
_AnyTimeDelta
) public or replace them with the corresponding unions (e.g.bt.TimeDelta | dt.timedelta | ht.timedelta
)- Make TypeVars (e.g.
_TOtherRaw
) public
- Challenge: some of the waveforms use the same TypeVar name with different bounds. These may need to live in separate submodules or be renamed.
In a few years, Python 3.11 will go EOL. At that point, we can replace the TypeVars with PEP 695 generic syntax. However, we do not necessarily need to break compatibility with code that imports our exported TypeVars. We can keep exporting them as long as we want, and we can also implement a module-level
__getattr__
that emits DeprecationWarning if they are imported.