Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for venv #25

Open
Aplietexe opened this issue Jan 16, 2023 · 2 comments
Open

Add support for venv #25

Aplietexe opened this issue Jan 16, 2023 · 2 comments

Comments

@Aplietexe
Copy link

Currently, linters such as yamllint that are installed using Python require them to be installed globally. When they are installed in a venv, they work normally, but aren't seen by the linter extension.

Searched for any of yamllint; couldn't be found within $PATH: [
...
]

This is a problem as not only it requires polluting the $PATH, but can be hard to do in systems with multiple Python versions, where installed packages don't get added to the $PATH.

@Startouf
Copy link

I have the same problem with sqlfluff that I install in a venv folder using poetry. My sqlfluff executable is not available globally, and installed when I run poetry install. It can even be located outside the workspace directory but I activate

poetry config virtualenvs.in-project true

to have them in the project directory which should make things easier.

Note that the python extension picks up virtual environments
Screenshot 2023-03-20 at 13 50 33

And When I open my terminal, the sqlfluff binary exists

# Command ran automatically by VS Code
source /Users/cyrilduchon-doris/dev/MyJobGlasses/dbt-transformations/.venv/bin/activate

# When I try to lookup for sqlfluff
(dbt-transformations-py3.11) which sqlfluff
/Users/me/dev/project/dbt-transformations/.venv/bin/sqlfluff

Note that the .venv could have an arbitrary name. With poetry I can run poetry env info to get the following (because I install my tools with asdf)

poetry env info

Virtualenv
Python:         3.11.2
Implementation: CPython
Path:           /Users/me/dev/project/dbt-transformations/.venv
Executable:     /Users/me/dev/project/dbt-transformations/.venv/bin/python
Valid:          True

System
Platform:   darwin
OS:         posix
Python:     3.11.2
Path:       /Users/me/.asdf/installs/python/3.11.2
Executable: /Users/me/.asdf/installs/python/3.11.2/bin/python3.11

@skwde
Copy link

skwde commented Sep 15, 2023

Same issue here. At least for me, not being able to use dedicated linter environments is a nogo.

Since not all applications are possibly in the same environment I propose to use a configuration setting which prepends the PATH variable solely for use within the extension.

Something like

linter.prependPath: ["<path to bin1>", "<path to bin2>", ...]

in case linter.prependPath is empty the current behavior is used.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants