cuda-python icon indicating copy to clipboard operation
cuda-python copied to clipboard

EPIC: Typing enhancement

Open leofang opened this issue 11 months ago • 1 comments

cuda.core can benefit from clean and detailed type hints. The typing annotation can guide users to understand the API design and expected workflow.

leofang avatar Feb 24 '25 14:02 leofang

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.

carterbox avatar Mar 07 '25 20:03 carterbox