python-poetry / python-poetry/poetry
Poetry env use does not select specific interpreter
Nobody has claimed this yet.
- 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 (
-vvvoption).
- OS version and name: CentOS 7
- Poetry version: 1.1.15
- Python version: 3.6.8 (other interpreter versions not tested)
Issue
I have a small Poetry project that builds a C++ extension using the build.py mechanism. I appreciate that this isn't officially supported, but it works well. Occasionally, I would like to be able to debug this extension (say, using gdb), for which I want to use the debug version of my system-wide Python interpreter /usr/bin/python3.6dm, as opposed to the usual /usr/bin/python3.6.
The poetry env use function seems to be the right thing to achieve this, and the phrasing of the documentation supports this assumption:
use
Activates or creates a new virtualenv for the current project.
<python> The python executable to use.
The argument is the specific Python executable to use. So, let's try to change it:
$ readlink <venv-path>/bin/python
/usr/bin/python3.6
$ poetry env use /usr/bin/python3.6dm
Expected Result
$ readlink <venv-path>/bin/python
/usr/bin/python3.6dm
Actual Result
$ readlink <venv-path>/bin/python
/usr/bin/python3.6
Workaround
Setting the python symlink manually in the venv achieves the right result.
Thoughts
The output of poetry env info doesn't mention the specific interpreter path, which makes me think perhaps this debug/non-debug use case hasn't come up before. However, I chose to raise this as a bug rather than a feature because the documentation explicitly states "the python executable to use", implying that the above should work.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the poetry env use command and its documented <python> argument, then reproduce the issue using /usr/bin/python3.6dm and inspect the virtual environment's bin/python symlink. Done means the command selects the requested interpreter rather than retaining /usr/bin/python3.6, with poetry env info behavior considered as part of the result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100