question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue
  • 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.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:16
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

4reactions
sdispatercommented, Dec 11, 2018

PR #731 is ready for review 😃

4reactions
jgirardetcommented, Nov 14, 2018

I think this use case is not unusual : you clone a repo : do somethings you decide to fork it and then clone your fork you got two project with same name.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Packaging and distributing projects
To install a Python package in “editable”/”development” mode Change directory to the root of the project directory and run: python -m pip install...
Read more >
Standard way to embed version into Python package?
1'" (where the version is a string, of course) in the __init__.py" of the main package of your software. Then go for the...
Read more >
The right and wrong way to set Python 3 as default on a Mac
1. Install pyenv · 2. Install Python · 3. Set your global default · 13 Comments.
Read more >
Configure a Python interpreter | PyCharm Documentation
Click the Python Interpreter selector and choose Add New Interpreter. Press Ctrl+Alt+S to open Settings/Preferences and go to Project: <project name> | Python...
Read more >
How to switch Python versions in Windows 10. Set Python path
In this tutorial, I'll show how to switch between Python versions in Windows 10. It's important to know how to change the Python...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found