Skip to content
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: Add version aliases #2966

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kmsquire
Copy link

@kmsquire kmsquire commented May 21, 2024

Make sure you have checked all steps below.

Prerequisite

  • Please consider implementing the feature as a hook script or plugin as a first step.
    • pyenv has some powerful support for plugins and hook scripts. Please refer to Authoring plugins for details and try to implement it as a plugin if possible.
      • This is a modification of an existing plugin (pyenv-build)
  • Please consider contributing the patch upstream to rbenv, since we have borrowed most of the code from that project.
    • We occasionally import the changes from rbenv. In general, you can expect changes made in rbenv will be imported to pyenv too, eventually.
    • Generally speaking, we prefer not to make changes in the core in order to keep compatibility with rbenv.
      • Not applicable; this modification happens in the pyenv-build plugin, which does not exist upstream
  • My PR addresses the following pyenv issue (if any)

Description

  • Here are some details about my PR

An older plugin, pyenv-alias, allowed naming the desired python version with an alias, which allowed installing multiple versions of the same python version. This is particularly useful on Apple silicon if you want to install both arm and x86_64 versions of python.

Unfortunately, this plugin broke when the code was modified to allow multiple versions to be specified at once on the command line, and the updated code does not allow non-invasive modification of the version number.

Tests

  • My PR adds the following unit tests (if any)

    • None

@kmsquire kmsquire force-pushed the feature/version-aliases branch from 9962c5d to 2700ac2 Compare May 21, 2024 18:32
An older plugin, pyenv-alias, allowed naming the desired python version with
an alias, which allowed installing multiple versions of the same python
version.  This is particularly useful on Apple silicon if you want to install
both arm and x86_64 versions of python.

Unfortunately, the pyenv-alias plugin broke when the code was updated to
allow specifying multiple versions of Python to install at once, and the
current code is not amenable to modifying the version in place with another
plugin.
@kmsquire kmsquire force-pushed the feature/version-aliases branch from 2700ac2 to b4b8f71 Compare May 21, 2024 18:33
@kmsquire
Copy link
Author

I just realized that I didn't add documentation. If this functionality looks reasonable to add, I'll be sure to do so!

@native-api
Copy link
Member

I really don't like the idea of having to supply an argument via an envvar -- but can't readily recall anything better.

I guess we should do a brainstorm in a discussion. Someone must have been solving the same problem before!

An idea from the top of my head is an array option -- one that can be specified multiple times.
Another is to somehow pair arguments and the options.

@kmsquire
Copy link
Author

I'm okay with either an array option, or pairing the arguments and options. I think the array option would be easier to implement.

@kmsquire kmsquire changed the title Add version aliases WIP: Add version aliases May 22, 2024
@kmsquire
Copy link
Author

So it turns out that I broke non-aliased builds in this. I'll look into it.

@native-api
Copy link
Member

native-api commented Jun 3, 2024

Got a nice-looking idea of how to couple a version and its alias: with a colon separator. A colon shouldn't normally be present in directory names (which Pyenv-managed installation names effectively are) since it's PATH separator.

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.

Install python version under a different name
2 participants