Skip to content

Added pyenv-latest support. #493

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

Merged

Conversation

uhx
Copy link
Contributor

@uhx uhx commented Mar 2, 2023

Usage and behavior is the same as in the original version of pyenv-latest (refers to this)

Prefix auto-resolution to the latest version also turned on for such commands: install, uninstall, global, local

So, from now user can just execute the following commands without having to search for the latest patch (and even minor) version

pyenv install 3.10
pyenv global 3.10

Closes #407, closes #372

note: issues above are outdated, pyenv-latest behavior has been changed and my PR fully (i hope so) supports it

uhx added 3 commits March 2, 2023 23:47
Usage and behavior is the same as in the original version of pyenv-latest.

Prefix auto-resolution to the latest version also turned on for such commands: install, global, local

So, from now user can just execute the following commands without the need of searching for latest patch version (or even minor)

pyenv install 3.10
pyenv global 3.10
@uhx uhx force-pushed the pyenv-latest-feature branch from 4b9b228 to 55d5d08 Compare March 8, 2023 22:01
@uhx
Copy link
Contributor Author

uhx commented Mar 14, 2023

Hey, @kirankotari

feel free to drop some comments so I can make a fix. I really want this feature :)

At this point I see the only problem in -arm support, because I don't know how to handle & test this properly; I can see that some functions can't handle the arm versions too, e.g. there is still function Is32Bit which is used for -win32 postfix auto-resolution in pyenv-install, and so on...

btw, my changes did nothing to the old-styled commands, it is still possible to use install/global/local by providing full version name, so no conflicts and all tests pass fine

@uhx uhx force-pushed the pyenv-latest-feature branch from 2d8879b to b0e955c Compare March 14, 2023 15:46
uhx added 2 commits March 17, 2023 00:35
From now it may pin python version without patch.
Also fixed pyenv-install without arguments: it should pick the local/global version and then install it.
@uhx
Copy link
Contributor Author

uhx commented Mar 16, 2023

Sooo

I noticed the #505 issue and decided to work on it, because I think it is the part of pyenv-latest feature. I checked the original pyenv behavior and from now auto-resolution feature finally should work the same way.

It's still possible to use the exact version...

PS C:\Users\uhx\Projects\pyenv-win> .\pyenv-win\bin\pyenv.bat local 3.11.2-win32
PS C:\Users\uhx\Projects\pyenv-win> type .\.python-version
3.11.2-win32
PS C:\Users\uhx\Projects\pyenv-win> .\pyenv-win\bin\pyenv.bat exec python -c "import sys; print(sys.version)"
3.11.2 (tags/v3.11.2:878ead1, Feb  7 2023, 16:24:28) [MSC v.1934 32 bit (Intel)]

But from now you can pin just a minor (or major) version and run install / exec

PS C:\Users\uhx\Projects\pyenv-win> .\pyenv-win\bin\pyenv.bat local
3.7
PS C:\Users\uhx\Projects\pyenv-win> .\pyenv-win\bin\pyenv.bat install
:: [Info] ::  Mirror: https://www.python.org/ftp/python
:: [Installing] ::  3.7.9 ...
:: [Info] :: completed! 3.7.9
PS C:\Users\uhx\Projects\pyenv-win> .\pyenv-win\bin\pyenv.bat exec python --version
Python 3.7.9

So the local/global command should just pin unchanged user input, as pyenv does:

root@f2a41ae37ecf:~# /root/.pyenv/bin/pyenv local 3.11 3.10
root@f2a41ae37ecf:~# /root/.pyenv/bin/pyenv exec python --version
Python 3.11.2
root@f2a41ae37ecf:~# /root/.pyenv/bin/pyenv local
3.11
3.10

The previous behavior of these commands was to modify the user input (resolve version/add postfix) and then save it to the ".python-version". From now we pin the original user input (if it's correct) and resolve it each time we call python shims. Check the updated tests if you can't catch this.

@kirankotari kirankotari changed the base branch from master to feature/pyenv-install-latest March 20, 2023 00:03
@kirankotari kirankotari merged commit 7321644 into pyenv-win:feature/pyenv-install-latest Mar 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pyenv install x.y:latest feature: Support pyenv install x.y:latest, like pyenv does
2 participants