mirror of
https://github.com/astral-sh/ruff.git
synced 2025-09-28 04:45:01 +00:00
[red-knot] Support stub packages (#17204)
## Summary This PR adds support for stub packages, except for partial stub packages (a stub package is always considered non-partial). I read the specification at [typing.python.org/en/latest/spec/distributing.html#stub-only-packages](https://typing.python.org/en/latest/spec/distributing.html#stub-only-packages) but I found it lacking some details, especially on how to handle namespace packages or when the regular and stub packages disagree on whether they're namespace packages. I tried to document my decisions in the mdtests where the specification isn't clear and compared the behavior to Pyright. Mypy seems to only support stub packages in the venv folder. At least, it never picked up my stub packages otherwise. I decided not to spend too much time fighting mypyp, which is why I focused the comparison around Pyright Closes https://github.com/astral-sh/ruff/issues/16612 ## Test plan Added mdtests
This commit is contained in:
parent
c12c76e9c8
commit
6cc2d02dfa
4 changed files with 443 additions and 36 deletions
|
@ -96,6 +96,9 @@ impl ModuleKind {
|
|||
pub const fn is_package(self) -> bool {
|
||||
matches!(self, ModuleKind::Package)
|
||||
}
|
||||
pub const fn is_module(self) -> bool {
|
||||
matches!(self, ModuleKind::Module)
|
||||
}
|
||||
}
|
||||
|
||||
/// Enumeration of various core stdlib modules in which important types are located
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue