-
Notifications
You must be signed in to change notification settings - Fork 131
Description
Summary
Environment: ty v0.0.1a12, Python 3.12, macOS, uv project
Problem: ty check reports unresolved-import errors for Cython extensions compiled to .so files, despite the imports working correctly at runtime.
Console Output:
error[unresolved-import]: Cannot resolve imported module `.math_utils`
--> src/__init__.py:5:7
|
5 | from .math_utils import add
| ^^^^^^^^^^
Project Structure:
src/
├── __init__.py
├── math_utils.pyx # Cython source
└── math_utils.cpython-312-darwin.so # Compiled extension (exists)
Issue: ty only looks for .py files but not compiled .so extensions. The import from .math_utils import ... fails because ty cannot find a [math_utils.py]
Expected: ty should resolve imports from compiled Cython extensions when:
A .pyx source file exists
A corresponding .so file is present
The package is properly built/installed
Impact:
False positives make ty unusable for projects using Cython extensions, which are common in scientific Python, performance-critical libraries, and hybrid codebases.
Workaround: None effective (stub files don't work for dynamic imports from compiled extensions).