Closed Queuecumber closed 2 years ago
poetry env info -p
for (1) I may be misunderstanding the purpose of this plugin, I thought it was to automatically activate poetry venv when CDing into a poetry controlled project folder, in which case why would we care about the default vox folder, we would only care about the default poetry folder
For (2/3) I agree with you
I have released a new version with the fix. It will fallback to poetry env.
This fails with the following exception (which was initially hidden by a contextmanager that I had to comment out)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1845, in _execute_child
raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: 'poetry'
poetry commands work fine when run in the xsh shell
Seems like it needs a full path, changing it to p = Path(run("/home/max/.local/bin/poetry", "env", "info", "-p"))
works
Seems like you want from xonsh.lib.subprocess import check_output
instead of the one from pythons subprocess library so that it gets resolved using the $PATH
set in xonsh
I see this as a vox plugin that supports poetry created environments. I personally use the vox commands to delete/upgrade the poetry environments. It auto-completes when kept in the same place.
Cant the existing autovox plugin handle that? I haven't used xonsh long so I don't know for sure how it works. How do you use the vox commands to create poetry environments?
The env is created by poetry but under $VIRTUALENV_HOME, and it is detected by this plugin. Autovox was slow in my case, so I created this one.
Poetry configures something like:
as the default virtualenv dir not
~/.virtualenvs
So if you try to load this plugin it wont work with a vanilla poetry setup.
poetry env info -p
if you know the user is in a poetry project directory but can't find anything manually is probably a good idea. Right now I don't know if the code can ever hit this option because the "no venvs" option will get hit first and returnAlso I'm pretty sure line 64 should explicitly return
None
instead of just being a return statement