https://pantsbuild.org/ logo
#general
Title
# general
r

rhythmic-morning-87313

07/13/2022, 3:56 PM
Is there a way to export the tools together into the
python-default
environment? For instance, when using Vim, I need to activate the venv for the Vim ALE/LSP plugins to auto-detect and utilize the tools like flake8, black, etc.
h

hundreds-father-404

07/15/2022, 6:43 PM
No, this is not currently possible. For utilizing tools, how are you setting that up with your IDE?
r

rhythmic-morning-87313

07/17/2022, 3:14 AM
For VSCode, I can individually configure each tool's executable path (e.g.,
dist/export/python/virtualenvs/tools/flake8/bin/flake8
), but for Vim ALE and similars, I could activate only one venv (
python-default
) at a time and don't have access to the tools.
Ah, ALE also provides individual executable configs
But currently ALE only provides the global configs and "pipenv", "poetry" special values to integrate with them (to use
poetry run flake8
for example)
We need extra care for directry-local vim configurations
added
set exrc
to the user-level vimrc and put the following in the
.vimrc
of the build root:
Copy code
let g:ale_python_flake8_executable = 'dist/export/python/virtualenvs/tools/flake8/bin/flake8'
let g:ale_python_isort_executable = 'dist/export/python/virtualenvs/tools/isort/bin/isort'
let g:ale_python_mypy_executable = 'dist/export/python/virtualenvs/tools/mypy/bin/mypy'
let g:ale_python_mypy_options = '--python-executable=dist/export/python/virtualenvs/python-default/3.10.5/bin/python'
let g:ale_fixers = {'python': ['isort']}
let g:ale_fix_on_save = 1
mypy option's
--python-executable
is crucial to make it able to find the stubs and external dependencies
(along with
mypy_path = "stubs:src"
in mypy.ini or pyproject.toml)
isort auto fix seems not working yet... hmm
4 Views