Feature Request: Automatically Use `project.requires-python` as `pythonVersion` in Basedpyright Configuration
This feature request proposes that Basedpyright should automatically use the requires-python field from the [project] section of pyproject.toml as the default value for the pythonVersion setting in the [tool.basedpyright] section. This would ensure consistency between the project's required Python version and the version used by Basedpyright for static analysis.
Related Issue: https://github.com/microsoft/pyright/issues/7561
i like this idea. though i think to do this we would also need to do #8, since requires-python can be a range, eg:
[project]
requires-python = ">=3.9,<3.14"
I also like this. Ruff uses this too. I think for now you can set it to the minimum version because that's usually what you want to target.
Astral's ty typechecker has this to say about how it uses [project].requires-python:
The Python version affects allowed syntax, type definitions of the standard library, and type definitions of first- and third-party modules that are conditional on the Python version.
By default, the lower bound of the project's requires-python field (from the pyproject.toml) is used as the target Python version, ensuring that features and symbols only available in newer Python versions are not used.