Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature Request: Automatically Use project.requires-python as pythonVersion in Basedpyright Configuration #921

Open
A-kirami opened this issue Dec 2, 2024 · 2 comments
Labels
config issues relating to config (pyproject.toml, pyrightconfig.json, LSP config or vscode extension) rejected upstream also a bug in pyright/pylance or feature that isn't in pyright/pylance - they refused to address it

Comments

@A-kirami
Copy link

A-kirami commented Dec 2, 2024

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:
microsoft/pyright#7561

@DetachHead DetachHead added the config issues relating to config (pyproject.toml, pyrightconfig.json, LSP config or vscode extension) label Dec 2, 2024
@DetachHead
Copy link
Owner

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"

@DetachHead DetachHead added the rejected upstream also a bug in pyright/pylance or feature that isn't in pyright/pylance - they refused to address it label Dec 2, 2024
@kiyoon
Copy link
Contributor

kiyoon commented Dec 20, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
config issues relating to config (pyproject.toml, pyrightconfig.json, LSP config or vscode extension) rejected upstream also a bug in pyright/pylance or feature that isn't in pyright/pylance - they refused to address it
Projects
None yet
Development

No branches or pull requests

3 participants