Skip to content

[Feature Request] poetry init and poetry new could/should respect virtualenvs.prefer-active-python configuration option #7073

@david-vicente

Description

@david-vicente

Discussed in https://github.com/orgs/python-poetry/discussions/7059

Originally posted by david-vicente November 19, 2022
Consider the following situation: I'm using pyenv to manage my python versions and want to start a new project using poetry.

I thought that if I ran

$ pyenv versions
* system
  3.11.0 
$ pyenv shell 3.11.0

Then using poetry to start a new project, like

$ poetry new myproject

would create a new folder with all the relevant stuff inside, and file pyproject.toml would be

[tool.poetry]
name = "myproject"
version = "0.1.0"
description = ""
authors = ["Me <[email protected]>"]
readme = "README.md"

[tool.poetry.dependencies]
python = "^3.11"


[build-system]
requires = ["poetry-core"]
build-backend = "poetry.core.masonry.api"

notice the python version. However this is not the case as poetry new <project name> seems to ignore the active python version and go with the system one.

Is this the intended behavior? Shouldn't poetry new and poetry init take into consideration the active python version?

I'm aware of other issues with similar questions:

Metadata

Metadata

Assignees

Labels

area/cliRelated to the command linearea/initRelated to 'poetry init'/project creationarea/uxFeatures and improvements related to the user experiencekind/featureFeature requests/implementations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions