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

Global shims in projects not managed by rye #1121

Open
bayashi-cl opened this issue May 28, 2024 · 5 comments · May be fixed by #1122
Open

Global shims in projects not managed by rye #1121

bayashi-cl opened this issue May 28, 2024 · 5 comments · May be fixed by #1122

Comments

@bayashi-cl
Copy link

Steps to Reproduce

Start Global Shims within the sampleproject.

rye config --set-bool behavior.global-python=true
git clone https://github.com/pypa/sampleproject.git
cd sampleproject
python +3.11

Expected Result

The Python shell will start.

Actual Result

The command will fail with error.

error: Explicit Python selection is not possible within Rye managed projects.

Version Info

❯ rye --version
rye 0.34.0
commit: 0.34.0 (d31340178 2024-05-20)
platform: linux (x86_64)
self-python: [email protected]
symlink support: true
uv enabled: true

Stacktrace

No response

@bayashi-cl bayashi-cl linked a pull request May 28, 2024 that will close this issue
@lvignoli
Copy link

For completeness, simply running python gives

error: Target Python binary 'python' not found in project. Most likely running 'rye sync' will resolve this.

What was the reasoning behind this default behaviour?

@heavywatal
Copy link

I am also confused by the inconsistent behavior of rye shims.

A toolchain seems to be working fine with behavior.global-python=true, but rye suddenly refuses to use it once it finds an empty file named pyproject.toml:

which python3
# /Users/watal/.rye/shims/python3
python3 -c "import sys; print(sys.prefix)"
# /Users/watal/.rye/py/[email protected]
touch pyproject.toml
python3 -c "import sys; print(sys.prefix)"
# /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9

@kivo360
Copy link

kivo360 commented Jun 5, 2024

I'm gonna add to this. The global behavior isn't very good. I have to do lots of work arounds to make it work.

@lvignoli
Copy link

lvignoli commented Jun 6, 2024

It seems @bayashi-cl has it right with #1122: for python projects not managed by rye (so no tool.rye.managed = true), rye should probably use global python all the time, through global shims if activated.

@mitsuhiko
Copy link
Collaborator

I agree that the current behavior is not ideal but I think rather than patching around on the behavior it would be better to take a step back and rethink what the actual intended behavior should be for all cases.

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 a pull request may close this issue.

5 participants