Closed nikita-orca closed 2 years ago
Added simple check for poetry.lock for now. (The only edge case is when the user will have poetry but no deps, but basically, he needs at least pytest anyway)
Found the cli command to get the actual venv path for poetry, but this piece of code is broken for some reason (I don't know lua actually). I tried changing the directory for shell command inside io.popen (with cd/pushd and popd), but probably was doing that wrong
if lib.files.exists("pyproject.toml") then
local f = assert(io.popen("poetry env info -p 2>/dev/null", "r"))
local venv = assert(f:read("*a"))
f:close()
if venv then
return { Path:new(venv, "bin", "python").filename }
end
end
Hey thanks for the PR! A pyproject.toml doesn't necessarily mean Poetry is available (this repo for example), is there another way to determine if poetry is in use? We could add a TOML parser in the neotest libs like there is for XML but ideally it'd nice if there was some command like
poetry --is-active