facebook / facebook/pyrefly

Respect `VERSIONS` file in typeshed

Open
#2,535 2 comments 1 reaction 1 assignee Claimed by @asukaminato0721 View on GitHub
typechecking typeshed usability
Dominant language
Rust
Stars
7k
Forks
516
PR merge metrics
No merged PRs in 30d

Description

### Describe the Bug

Typeshed contains a [`VERSIONS` file](https://github.com/python/typeshed/blob/main/stdlib/VERSIONS) indicating stdlib modules' version availability. For example, the `distutils` package is only available from Python 3.0 to 3.11, so importing it in Python 3.12+ is considered an error that gets reported by all of mypy, pyright, and ty:
```python
import distutils # Should be an error in python 3.12+, but pyrefly is silent
```
Pyrefly probably needs to include this `VERSIONS` file into its bundled typeshed, and adjust what `BundledTypeshed` contains dynamically based on the python version.

### Sandbox Link

https://pyrefly.org/sandbox/?project=N4IgZglgNgpgziAXKOBDAdgEwEYHsAeAdAA4CeSIEAtsbgE4AuABJhHAwK4PQIA0IXHiXKIQAYiYBVblAgNSTMB3QBjbrnRwAOuh2YYYRfSqoGAfXQcq2GHQAU%2BREwjoGASiYBaAHxN2dRB0mYKY6GE46dEUtEAA5KxsApmB8AF8YnRB%2BMjCwKFJCBlwqKAoJAAVSXPy-DBwCJhUNSABzDjpTCA1CHQkAZRgYJgALBgZiOEQAeimcg3zCehapmHQpzFwVOCmm9Fb2zo0pozomVAA3VGhUbFhG5og2jvUo3GIXuB70MgZhjU9zrY4F0ogBeJgxADMhAAjAAmDLoECpfioNQQQEAMWgMAoaCweCIZGRQA

### (Only applicable for extension issues) IDE Information

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.