cuda-python
cuda-python copied to clipboard
EPIC: Typing enhancement
cuda.core can benefit from clean and detailed type hints. The typing annotation can guide users to understand the API design and expected workflow.
Something that I noticed when using migrating nvmath-python to cuda.core is that not all types are importable from the same level. For example
from cuda.core.experimental import Device, Stream
from cuda.core.experimental._event import Event # shouldn't need to import _event to get Event
def some_function(device: Device, stream: Stream, event: Event) -> None:
pass
If you're a downstream project and you also want to use type hints, the Event type is not part of the public API, but it is returned from parts of the public API, so it should be accessible without having to import a private module.