Poetry: Virtual environments should include python minor version

Created on 2 Jul 2020  路  1Comment  路  Source: python-poetry/poetry

  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.
  • [ x] I have searched the documentation and believe that my question is not covered.

Feature Request

I think this is somewhat related to #2282 but perhaps framed differently

I am using pyenv with poetry. It looks like poetry creates/uses virtual environments strictly based on the python major version.
eg it will distinguish between 3.7 vs 3.8 but not between 3.8.2 vs 3.8.3
This makes switching between two different minor versions of python difficult.

pyenv shell 3.7.8
poetry env info # displays virtual env created with python 3.7.8
pyenv shell 3.8.2
poetry env info  # displays virtual env created with python 3.8.2
pyenv shell 3.8.3
poetry env info  # still displays python 3.8.2 virtual env

It is not difficult to work around this using pyenv virtualenv and disabling poetry's virtualenv handling.
However, I think it makes more sense for poetry to include the minor version when determining the virtual environment.

Feature Triage

Most helpful comment

ah cool. poetry env use XX has a slightly different behavior though. it updates the same virtualenv in place.

pyenv shell 3.8.3
poetry env use 3.8
# Recreating virtualenv ...

and if i want to go back to 3.8.2 i need to recreate the virtualenv again: (otherwise the virtualenv remains stuck in 3.8.3)

pyenv shell 3.8.2
poetry env use 3.8
# Recreating virtualenv ...

i would prefer it to create a new, independent virtualenv for each underlying pyenv executable

yes, generally i would probably not be running multiple minor versions.
but when a new minor version is released, it is convenient for testing purposes to easily switch between independent environments.

furthermore, i think the current behavior is unintuitive and can be surprising to new users.

>All comments

ah cool. poetry env use XX has a slightly different behavior though. it updates the same virtualenv in place.

pyenv shell 3.8.3
poetry env use 3.8
# Recreating virtualenv ...

and if i want to go back to 3.8.2 i need to recreate the virtualenv again: (otherwise the virtualenv remains stuck in 3.8.3)

pyenv shell 3.8.2
poetry env use 3.8
# Recreating virtualenv ...

i would prefer it to create a new, independent virtualenv for each underlying pyenv executable

yes, generally i would probably not be running multiple minor versions.
but when a new minor version is released, it is convenient for testing purposes to easily switch between independent environments.

furthermore, i think the current behavior is unintuitive and can be surprising to new users.

Was this page helpful?
0 / 5 - 0 ratings