Skip to content

Comments

Install PyPy/GraalPy into ~/.local/bin as pypy/graalpy#14201

Closed
RazerM wants to merge 1 commit intoastral-sh:mainfrom
RazerM:feature/python-install-basename
Closed

Install PyPy/GraalPy into ~/.local/bin as pypy/graalpy#14201
RazerM wants to merge 1 commit intoastral-sh:mainfrom
RazerM:feature/python-install-basename

Conversation

@RazerM
Copy link
Contributor

@RazerM RazerM commented Jun 22, 2025

Summary

Resolves #13565

Test Plan

Running the install and uninstall commands.

Comment on lines 394 to 399
match self.implementation() {
LenientImplementationName::Known(ImplementationName::PyPy) => "pypy",
LenientImplementationName::Known(ImplementationName::GraalPy) => "graalpy",
LenientImplementationName::Known(ImplementationName::CPython) => "python",
LenientImplementationName::Unknown(_) => "python",
}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI this duplicates some code found in ManagedPythonInstallation::executable:

let implementation = match self.implementation() {
ImplementationName::CPython => "python",
ImplementationName::PyPy => "pypy",
ImplementationName::GraalPy => "graalpy",
};

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That other code seems wrong, I think we should just do #14337

Here, I think we should probably do the same thing and make use of

impl<'a> From<&'a LenientImplementationName> for &'a str {
fn from(value: &'a LenientImplementationName) -> &'a str {
match value {
LenientImplementationName::Known(implementation) => implementation.into(),
LenientImplementationName::Unknown(name) => name,
}
}
}

Copy link
Member

@zanieb zanieb Jun 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh funny, that doesn't work because of cpython, I guess we need a special case for that 😭 I'll push a commit to that pull request for it

@konstin konstin requested review from Gankra and zanieb and removed request for zanieb June 24, 2025 19:56
@konstin konstin added the enhancement New feature or improvement to existing functionality label Jun 24, 2025
@Gankra
Copy link
Contributor

Gankra commented Jun 26, 2025

It would be a pretty big breaking change to just do this by default. I would think if we wanted to do this we'd want to default to installing it as both python3.12 and pypy3.12, with an option to opt out of the "default" name. This kind of change needs a lot of design work.

@zanieb zanieb added preview Experimental behavior labels Jun 26, 2025
@zanieb
Copy link
Member

zanieb commented Jun 26, 2025

The feature is in preview, so we can make changes like this though I agree we need to do some design work to be certain we should. I'm not sure if we should ever install PyPy or GraalPy as python, is that common? We'd definitely need to do some research to understand common patterns there.

@RazerM
Copy link
Contributor Author

RazerM commented Jun 26, 2025

I'm not sure if we should ever install PyPy or GraalPy as python, is that common?

I agree, and I don't think it's common. I'm not aware of any way to install PyPy (I have no experience with GraalPy) which would put it on your PATH as python... instead of pypy..., which is what my comment in #13565 about what brew and apt do was referencing.

See also https://doc.pypy.org/en/latest/build.html#installation (emphasis mine):

To install PyPy system wide on unix-like systems, it is recommended to put the whole hierarchy alone (e.g. in /opt/pypy) and put a symlink to the pypy executable into /usr/bin or /usr/local/bin.

zanieb added a commit that referenced this pull request Jun 28, 2025
Motivated by some code duplication highlighted in
#14201, I noticed we weren't taking
advantage of the existing implementation for casting to a str here.
Unfortunately, we do need a special case for CPython still.
@RazerM RazerM force-pushed the feature/python-install-basename branch from e0004c2 to bf27ceb Compare June 28, 2025 20:09
@RazerM
Copy link
Contributor Author

RazerM commented Jul 24, 2025

Was this overlooked when the feature was stabilized for 0.8, or you decided pypy- should be installed as python-?

@zanieb
Copy link
Member

zanieb commented Sep 25, 2025

We just didn't get to this, but we should.

@zanieb zanieb added this to the v0.9.0 milestone Sep 25, 2025
@zanieb zanieb added the breaking A breaking change label Sep 25, 2025
@zanieb zanieb modified the milestones: v0.9.0, v0.10.0 Oct 12, 2025
@konstin konstin force-pushed the feature/python-install-basename branch from bf27ceb to 7f29aba Compare January 26, 2026 14:09
zanieb added a commit that referenced this pull request Jan 30, 2026
@zanieb
Copy link
Member

zanieb commented Jan 30, 2026

Moved to #17756 — thank you!

@zanieb zanieb closed this Jan 30, 2026
konstin pushed a commit that referenced this pull request Jan 30, 2026
zanieb added a commit that referenced this pull request Feb 3, 2026
zanieb added a commit that referenced this pull request Feb 3, 2026
zanieb added a commit that referenced this pull request Feb 4, 2026
zanieb added a commit that referenced this pull request Feb 5, 2026
zanieb added a commit that referenced this pull request Feb 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking A breaking change enhancement New feature or improvement to existing functionality preview Experimental behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install PyPy to PATH as pypy/pypy3

4 participants