freezing-lamp-12123
11/02/2022, 3:05 PMProcess
or ProcessResult
— i’m not being able to auto import and manage the imports for it … — while if i reference symbols from my local plugin it works just fine — when i do import by hand, vscode knows where the source can be found and i can jump directly into definitions …
anyway to make that include detection smarter?pylance
is the default chosen language serverwide-midnight-78598
11/02/2022, 3:11 PMctrl + space
for me) won't find it, but quick fix will (cmd + .
)
I think creating a venv with the pants plugin from pypi helps with the autocompletefreezing-lamp-12123
11/02/2022, 3:15 PMbitter-ability-32190
11/02/2022, 3:15 PMfreezing-lamp-12123
11/02/2022, 3:19 PMbitter-ability-32190
11/02/2022, 3:19 PMfreezing-lamp-12123
11/02/2022, 3:20 PM./pants export ::
and setup PYTHONPATH
bitter-ability-32190
11/02/2022, 3:20 PMfreezing-lamp-12123
11/02/2022, 3:20 PMwide-midnight-78598
11/02/2022, 3:21 PM./pants export ::
also export the pants-plugin? I would assume it does, but 🤷bitter-ability-32190
11/02/2022, 3:22 PM::
should match some plugin code, and then export will export a ve for the resolvefreezing-lamp-12123
11/02/2022, 3:22 PMwide-midnight-78598
11/02/2022, 3:24 PMfreezing-lamp-12123
11/02/2022, 3:38 PMbitter-ability-32190
11/02/2022, 3:38 PMve
should have python. Fire that up and try import pants
?freezing-lamp-12123
11/02/2022, 7:30 PMbitter-ability-32190
11/02/2022, 7:30 PMfreezing-lamp-12123
11/03/2022, 8:43 AMimport pants
just fine …
if i try through the terminal in vscode, it seems like it’s really wanting to use an old python installed via pyenv
.. even though i set the interpreter specifically through the command palettecold-vr-15232
11/03/2022, 9:24 AMfreezing-lamp-12123
11/03/2022, 9:44 AM[python]
interpreter_constraints = ["CPython==3.9.*"]
in pants.toml
for that reasoncold-vr-15232
11/03/2022, 10:01 AMfreezing-lamp-12123
11/03/2022, 10:05 AM❯ ./pants export ::
11:07:50.70 [ERROR] 1 Exception encountered:
ProcessExecutionFailure: Process 'Searching for `bash` on PATH=/usr/bin:/bin:/usr/local/bin' failed with exit code -9.
stdout:
stderr:
Use `--keep-sandboxes=on_failure` to preserve the process chroot for inspection.
❯ readlink -f dist/export/python/virtualenv/3.9.15/bin/python
/opt/homebrew/Cellar/python@3.9/3.9.15/Frameworks/Python.framework/Versions/3.9/bin/python3.9
below works, no error:
❯ ./dist/export/python/virtualenv/3.9.15/bin/python -c "import pants"
pants
modules …. 🤯python.analysis.extraPaths
… no dice.cold-vr-15232
11/03/2022, 10:19 AMfreezing-lamp-12123
11/03/2022, 10:29 AMdist/export/python/virtualenv/3.9.15/bin/python
is a symlink directly to the python installed via homebrewpyenv
and after reinstalling vscode, and playing with a bunch of settings trying to add paths manually and all sorts of other “try turning it on and off again” i finally got it to work … and i think once it became happy i didn’t need any of the custom settings anymore and it “just works” ™ now …
…. sigh, somedays are just ….{
"name": "pants",
"depth": 10,
"includeAllSymbols": true,
}
this config in "python.analysis.packageIndexDepths":
seems to have done the trick …wide-midnight-78598
11/03/2022, 12:09 PM.vscode
folder too), this process just worked for me (taking export
out of the picture for now).
# From my repo root
# After running this, VSCode sees there is a new .venv and asks me to use it in the workspace, to which I say yes
python3.9 -m venv .venv
source .venv/bin/activate
# First set of squiggles goes away within 1-2 seconds of this install completing
pip install pantsbuild.pants
# Remaining squiggle disappears after this installs
pip install pantsbuild.pants.testutil
It looks like this didn't play out correctly for you. So, I guess this leaves me wondering if this is a weird one-off, if it's something about the M1 environment, or it's related to ./pants export ::
, or all of the above..../pants export ::
- when I set the VSCode interpreter path to: ./dist/export/python/virtualenvs/pants-plugins/3.9.15/bin/python
that auto-complete works and my squiggs disappear.freezing-lamp-12123
11/03/2022, 6:23 PMwide-midnight-78598
11/03/2022, 7:22 PM