Relative imports from Cython files in cuda_core cause duplicate imports
@acosmicflamingo is already working on this.
Since Jul 23, 2026.
- Dominant language
- Cython
- Stars
- 3.4k
- Forks
- 329
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 116
Description
If you have code like
from . import typing
in a .pyx file, and another part of the system does:
from cuda.core.system import typing
it causes the typing module to be imported twice.
The first import places the module in sys.modules as cuda.core.cu13.system.typing, and the second import places the module in cuda.core.system.typing. It means that any isinstance checks on classes in this module will fail.
This is clearly a side effect of the "megapackage" approach handled by _import_versioned_module. It is not clear whether we can address it at that level.
At a minimum, maybe we can write a lint or an AGENT.md rule that relative imports should be avoided from Cython modules.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.