python-poetry / python-poetry/poetry

Poetry exposes relative PATH for virtual environment

Open
#2,871 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

kind/bug kind/enhancement status/triage
Dominant language
Python
Stars
34.3k
Forks
2.5k
Avg merge
2d 19h
Merged PRs (30d)
30

Description

  • I am on the latest Poetry version.

  • I have searched the issues of this repo and believe that this is not a duplicate.

  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option).

  • OS version and name: macOS Catalina 10.15.6

  • Poetry version: 1.0.10

Issue

When using a relative path for the virtualenvs.path configuration property, this path is exposed as relative path in the environments created by poetry run and poetry shell. For example, consider the following poetry.toml in the project root directory:

[virtualenvs]
path = ".venvs"

When running the command poetry run printenv, the output will contain something like this:

PATH=.venvs/my-project-py3.7/bin:...

This is problematic when running for example shell scripts that change the working directory, because they won't be able to run tools installed inside the virtual environment anymore:

$> which pytest
.venvs/my-project-py3.7/bin/pytest
$> cd tmp
$> which pytest
-- no output --

This could be avoided if poetry converted the virtual environment path to an absolute path.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the relative virtualenvs.path case with poetry run printenv and poetry shell, then trace the environment setup used by those entry points. The change is complete when PATH remains usable after a shell script changes directories, while preserving the documented .venvs configuration behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.