Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add poetry support #8

Closed
wants to merge 2 commits into from
Closed

Add poetry support #8

wants to merge 2 commits into from

Conversation

nikita-orca
Copy link
Contributor

No description provided.

@rcarriga
Copy link
Collaborator

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

@nikita-orca
Copy link
Contributor Author

nikita-orca commented Jun 18, 2022

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants