Skip to content

Add a way to set a fixed Python version for a project #621

@sdispater

Description

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

Issue

Since this is an issue that has arisen before (see #522) and there is some confusion around which Python version Poetry uses, introducing a more explicit way to tell which Python version to use seems reasonable.

Before we go into more details of what it would look like, it's important to note that the default behavior (using the currently activated Python) will remain. This new feature will only make it more convenient for people to choose explicitly what they want to use.

So, with that being said, here is what a possible implementation could look like.

This requires the introduction of a new command which would accept a python executable as an argument. The argument must be a full path to a Python executable or a python command that is in the path:

poetry project use --python python
poetry project use --python python3
poetry project use --python /full/path/to/python

What this command would do is create a virtualenv like the ones currently created in the form {project_name}-py3.6, and write the association of the virtualenv and the project to a file so that Poetry knows what to use.

If the virtualenv already exists and it is not currently associated with the project, it will be associated. This makes switching between virtualenvs easier.

This will likely be implemented for the release of the first stable 1.0.0 release.

Metadata

Metadata

Assignees

Labels

area/cliRelated to the command linearea/initRelated to 'poetry init'/project creationkind/featureFeature requests/implementations

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions