microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

Support dotenv files discovery #376

Open ilaner opened 1 year ago

ilaner commented 1 year ago

I'm using the pylint in VSCode to run a custom plugin of pylint. In the built in python extension, I set my the PYTHONPATH value in the .env file to the pylint plugin directory, and the extension is able to read the plugin and lint correctly. However, when I tried migrating to the new pylint extension, it doesn't discover the env file, and as the PYTHONPATH variable isn't set, I do not get results from the custom plugins.

karthiknadig commented 1 year ago

The temporary workaround until we resolve this is to set PYTHONPATH in your terminal before launching vscode from the terminal:

Linux/mac:

> cd <project dir>
> export PYTHONPATH=<path to your plugins>
> code .

Windows:

> cd <project dir>
> set PYTHONPATH=<path to your plugins>
> code .
MerrettM commented 1 year ago

Seeing similar issues with my current project, any idea on when we can expect the linked PR to make it into a release so we don't have to keep using the workaround? It's currently the only thing stopping us from switching to use the new extension.

adoebber commented 11 months ago

@karthiknadig Can you tell us when we can expect a fix for this issue? It would be nice if the new extension worked in the same way as the old deprecated one.

MerrettM commented 10 months ago

Found another workaround which doesn't involve manually setting the PYTHONPATH in the terminal before starting VS Code with the code . command, it's not perfect but it works for us. You just need to add the following to your workspace settings (credit to Shinebayar G's answer on Stack Overflow):

"python.analysis.extraPaths": ["<whatever-you-were-manually-setting-the-pythonpath-to-before>"]