`pythonVersion` not fully functional when used in executionEnvironments
- Dominant language
- Python
- Stars
- 15.6k
- Forks
- 1.8k
- Avg merge
- 12h 13m
- Merged PRs (30d)
- 52
Description
**Describe the bug**
When specifying a separate environment in `executionEnvironments` with lower `pythonVersion` than the root `pythonVersion`, the given environment doesn't behave equivalent as when lower `pythonVersion` is specified in the root.
**Code or Screenshots**
See this example repo: https://github.com/rchl/pyright-bug-temp
Files:
- `py313.py`
- `legacy/py38.py`
`pyrightconfig.json`
```json
{
"pythonVersion": "3.13",
"executionEnvironments": [
{
"pythonVersion": "3.8",
"root": "legacy"
}
]
}
```
`"pythonVersion": "3.8"` does have effect on the `legacy/*` file because it reports an issue about using `list` within a type alias but it doesn't report that `TypeAlias` is not available in `typing`.
The error is reported if `"pythonVersion": "3.8"` is specified at the root of the configuration.
It seems like pyright uses 3.13 runtime (or whatever latest version is installed) for each environment but then I don't get why it differs when specified in root.
Contributor guide
Research direction
Start by reproducing the discrepancy with the example repository, especially py313.py, legacy/py38.py, and pyrightconfig.json. Compare the diagnostics when pythonVersion 3.8 is configured under executionEnvironments versus at the root; done means the legacy environment reports that TypeAlias is unavailable in typing as it does with the root setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, devtools
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100