Prefer package imports to module imports in auto import
- Dominant language
- Rust
- Stars
- 7k
- Forks
- 519
- PR merge metrics
- No merged PRs in 30d
Description
### Describe the Bug
I have a monorepo managed by Pants and am using Pyrefly as my LSP. Let's say I have a layout like this:
```
.
└── root/
├── mod_a/
│ ├── __init__.py
│ └── utils.py
└── mod_b/
├── __init__.py
└── uses_utils.py
```
and `__init__.py` in `mod_a` has an `__all__` that exports all the functions in `utils.py`. Let's say that `utils.py` contains the definition of `some_func`. If I'm editing `uses_utils.py` and I type `some_func` Pyrefly correctly notices I don't have it imported and offers to add the `import` for me. But, if I accept that suggestion it adds `from mod_a.utils import some_func` instead of `from mod_a import some_func`. I think the latter should be the default but either way it'd be nice to at least have it be an option.
### Sandbox Link
_No response_
### (Only applicable for extension issues) IDE Information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.