Skip to content

Is it possible for 3rd party libraries to work with environment Python version when pythonVersion is set? #9607

Answered by erictraut
Azureblade3808 asked this question in Q&A
Discussion options

You must be logged in to vote

No, it's not possible to set the pythonVersion to be different for a third-party library. Pyright doesn't analyze third-party libraries separately from your files. When you import a symbol from a third-party library, its type is evaluated using the settings from the file that imports it. After all, the code in your file will be executed in the same environment as the library code that it's importing.

As you've noted, you can specify a different pythonVersion setting for different subdirectories in your project using the "execution environment" configuration support.

If you're developing code that must remain compatible with Python 3.8, I recommend using a 3.8 environment for your developm…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Azureblade3808
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants