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

cmd/pyenv-sync: Create major version symlink(s) to fix pyenv support #18978

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

Conversation

landoncrabtree
Copy link

Added proper pyenv support to brew pyenv-sync by symlinking major version executables to their minor.

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them?
  • Have you written new tests for your changes? Here's an example. - Test already exists for pyenv-sync
  • Have you successfully run brew style with your changes locally?
  • Have you successfully run brew typecheck with your changes locally?
  • Have you successfully run brew tests with your changes locally? - Errors here but none related to my changes.

This PR aims to fix brew pyenv-sync support. Prior to this, pyenv-sync only symlinks ~/.pyenv/versions/python{major}.{minor}.{patch} to /opt/homebrew/Cellar/python@{major}.{minor}/{major}.{minor}.{patch}. pyenv looks within the bin directory for executables, so by-default, the following executables are in PATH (in this example, for say [email protected])

2to3-3.12
idle3.12
pip3.12
pydoc3.12
python3.12
python3.12-config
wheel3.12

So, if a user invokes python3 or pip3, it will not be in ~/.pyenv/versions/___/binandpyenvwill fallback to system default (in this case, the latestpython3installation from Homebrew,python3.13). This commit adds additional symlinks: python3, pip3, wheel3, idle3, pydoc3that waypyenvversion management works as expected usingpython3andpip3`.

See the following for reference on what issue(s) this fixes:

Looks like it's been an issue for a while (July 2023). The proposed fixes are:

  • python formula adds the symlinks themselves
  • pyenv adds some sort of detection for Homebrew and checks libexec instead of bin
  • Users create the symlinks manually (eg: ln -s ~/.pyenv/versions/3.12.8/bin/python3.12 ~/.pyenv/versions/3.12.8/bin/python3)
  • pyenv-sync creates the symlinks (This seems like the most appropriate approach, which is what I have done)

@landoncrabtree landoncrabtree changed the title Added proper pyenv support to brew pyenv-sync by symlinking major ver… cmd/pyenv-sync: Create major version symlink(s) to fix pyenv support Dec 22, 2024
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.

1 participant