-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP : Change python version at install #82
Conversation
Thanks for taking the time to put this PR together. Unfortunately, this is not something I want to implement in |
Hi, I think that this PR simplifies much the usage of poetry and makes it more accessible for new users. PS: considering poetry is a new (great) thing for new project I'm close to open a Issue asking to drop python2 and let you more time for other things ;-) thanks for this project anyway |
The thing is with your changes is that you will only be able to have one virtualenv per project while the current implementation allows you to have one for each Python version you want to test you project with. And besides, if the Python version you want to use does not exist on your system you will still need to install it so there isn't much to gain here. |
ok I see where you wanna go. |
If you run different virtualenv with different python version, how the hashes un pyproject.lock could be ok for all different versions of python ? |
When poetry is locking the dependencies it is agnostic and, thus, will lock any dependency regardless of its requirements. However, when installing dependencies it will skip the ones that are not needed. This is the same thing for hashes, every hashes are put in the lock file to make it it environment independant. |
ok I close this useless work. so in a nutshell if you want to use different python version with poetry:
I think it's clear in your mind but you really should consider it isn't for others, especially for those not aware of thing like pyenv and I don't say for people coming from pipenv. Maybe you should consider adding something in the doc to explain it more than it is now. I still don't have you opinion on checking if current python version is compatible with the pyproject.toml #77 Jimmy |
@sdispater Say I'm using Poetry with pyenv-virtualenv, if I understand correctly, the recommended way is to install Poetry for every virtual environment, is that correct? |
@laike9m Not anymore. If you use the recommended installer Poetry will pickup the currently activated Python version to create virtualenvs, so you only need to install it once. Also if you are inside an activated virtualenv Poetry will automatically detect it and use it. |
@sdispater That's really cool. Thanks! |
@sdispater That is not a good solution, it will create a virtualenv which is different (and quite possibly incompatible) from what is declared in pyproject.toml |
I hit this issue as well. Using the recommended install approach on Mac OS X, I got What happens if I want |
Release 1.0.0b1
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
This PR is related to #77
you can choose your python version:
poetry install --python 3.6
It will install the asked python version if present on the system.
Doing this I have to change the virtualenv name to make poetry know where to search.
The new name is project name + a md5 calculated from the path of the project
/path/to/virtualenv/myproject-fzef84z38ef4ze8f4z3e
So the venv can always be found if the project's path doesn't change.
Tests are not yet fully ok.
this doesn't solve the problemeof consistency between the created venv and the python version needed in the pyproject.toml