Open Aplietexe opened 1 year ago
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
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
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.
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.
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.