You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to deal with conditional imports in a good way. This is a pretty common one: use tomllib when it's available (Python 3.11+) else depend on tomli.
basedpyright is configured to check Python 3.8+ compatibility but the development venv is installed with python 3.12. This seems to create a conflict (?), for example that tomli is required for Py 3.8 but it's not installed because the development environment doesn't need it. There is no venv configuration that does not cause unecessary
My best guesses from the pyright playground is that this issue exists there too.
I don't know what a solution looks like here. See the diagnostics below for a description of what happens.
try:
* import tomllib as tomli
└──── reportMissingImports: Import "tomllib" could not be resolved
except ImportError:
* import tomli as tomli
└──── reportMissingImports: Import "tomli" could not be resolved
if sys.version_info >= (3, 11):
import tomllib as tomli
└──── reportUnreachable: Code is unreachable
else:
* import tomli as tomli
└──── reportMissingImports: Import "tomli" could not be resolved
basedpyright --version
basedpyright 1.17.5
based on pyright 1.1.381
The text was updated successfully, but these errors were encountered:
How to deal with conditional imports in a good way. This is a pretty common one: use tomllib when it's available (Python 3.11+) else depend on tomli.
basedpyright is configured to check Python 3.8+ compatibility but the development venv is installed with python 3.12. This seems to create a conflict (?), for example that
tomli
is required for Py 3.8 but it's not installed because the development environment doesn't need it. There is no venv configuration that does not cause unecessaryMy best guesses from the pyright playground is that this issue exists there too.
I don't know what a solution looks like here. See the diagnostics below for a description of what happens.
Project dependencies:
Configuration:
Development environment installation:
First version of the code:
Alternative version of the code:
The text was updated successfully, but these errors were encountered: