ruff
6cc2d02d - [red-knot] Support stub packages (#17204)

Commit
90 days ago
[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
Author
Parents
  • crates/red_knot_python_semantic
    • resources/mdtest/import
      • File
        stub_packages.md
    • src/module_resolver
      • File
        module.rs
      • File
        path.rs
      • File
        resolver.rs