ruff: `ruff analyze graph` does not understand submodule imports
ruff 0.6.8
i see something like this:
{
"src/view.py": [
"src/models/User.py",
],
"src/code.py": [
"src/models/user.py",
],
}
content of src/models/__init__.py:
from models.user import User
__all__ = ['User']
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 21 (17 by maintainers)
Yeah, I think that’s a known limitation of the red-knot semantic model right now. There’s a test case with a TODO for it IIRC. I can look at doing the todo next week!
That’s correct, but I think that’s an issue in the analyze graph because it first tries to resolve
models.Userbefore testing formodelshttps://github.com/astral-sh/ruff/blob/3018303c8759b3e96d075c62eeb8b8ef24b4d0c3/crates/ruff_graph/src/resolver.rs#L27-L34
Red Knot does the resolution in the opposite order:
modelsmodels.userby looking upUserinmodelsThe repo don’t contains
User.py, onlyuser.py, so “src/ruff_analyze_tree/models/User.py” - is invalid.