davidhalter / davidhalter/jedi

Python stubs loaded from extensions folder even when using an explicit interpreter

Open
#1,982 8 comments 0 reactions 0 assignees View on GitHub
feature low-prio
Dominant language
Python
Stars
6.2k
Forks
535
PR merge metrics
No merged PRs in 30d

Description

Hopefully the title isn't too confusing, But let me explain the steps i went through and the problem im seeing.

1. Set an interpreter that isn't default (I'm using one in a venv)
2. Install custom stubs to that venv (I did `pip install micropython-esp8266-stubs`)
3. Open a python file using packages installed in that venv that you have stubs for (I am using `gc` and `machine`)
4. Observe that the `machine` package import lints correctly and if you go to definition it will open the `.pyi` file in that venv location, but if you do the same for the `gc` package it opens the `.pyi` file in the default extension location (in my example, it opens the path to the `jedi/third_party/typeshed/stdlib/*` file)

I'm happy to be told im wrong, but this seems like an oversight to me. In my program i am getting lint warnings, and not getting function previews/auto complete for my correct code, because the implementation of `gc` from micropython is different to the python standard library `gc`, but i am developing in a venv for this reason, and i can't seem to find any extension settings that allow me to explicitly tell vs code (or in my case, vscodium) to only use stubs in my venv location (or atleast change the priority order that they are looked for)

Extension version: 2024.0.0
VSCodium version: VSCodium 1.82.2 (a5004432af6600c99fa4f918a3f2f8df44df71e6, 2023-09-14T18:27:11.315Z)
OS version: Linux x64 6.1.0-17-amd64

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.