You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
fromcuda.core.experimentalimportDevice, Streamfromcuda.core.experimental._eventimportEvent# shouldn't need to import _event to get Eventdefsome_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.
One thing I noticed in gh-2215 (it is made worse by that PR), is that the auto generation of .pyi files from cython files works fine but preserve decorators.
That means that it keeps @cython.final (and now @cython.critical_section). I think @cython.final is typing friendly (@cython.critical_section probably not), however, we shouldn't even have cython as a runtime requirement.
Activity
typing.TYPE_CHECKINGto the maximum possible extent #468carterbox commentedon Mar 7, 2025
Something that I noticed when using migrating nvmath-python to
cuda.coreis that not all types are importable from the same level. For exampleIf you're a downstream project and you also want to use type hints, the
Eventtype 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.mdboom commentedon Jun 10, 2026
I think #2061 largely closes this bug, with the exception of the subissue #454 (stop repeating types in docstrings).
seberg commentedon Jun 15, 2026
One thing I noticed in gh-2215 (it is made worse by that PR), is that the auto generation of
.pyifiles from cython files works fine but preserve decorators.That means that it keeps
@cython.final(and now@cython.critical_section). I think@cython.finalis typing friendly (@cython.critical_sectionprobably not), however, we shouldn't even havecythonas a runtime requirement.I suspect we need to make this change upstream in https://github.com/jon-edward/stubgen-pyx, though.
(Although, if we are OK with the cython dependency for the stubs, then it can also be just nudging/making sure Cython types
critical_sectionnicely.)