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 shim's dependency management is confusing and non-intuitive #1093

Open
MatthewScholefield opened this issue May 19, 2024 · 5 comments

Comments

@MatthewScholefield
Copy link

There are some important open questions around using rye to manage the global Python version. Notably:

Given these open questions and the confusion it creates, I wonder if the global shim option should be removed, at the very least from the automated installer. What do you think?

Alternatively, if we get some docs on the global shim and know how to install packages and run ipython then that would also solve this issue.

@bluss
Copy link
Contributor

bluss commented May 19, 2024

Not a replacement for docs, but there is a video on how the rye shims work https://www.youtube.com/watch?v=TKnYcyz095g by Armin

Existing docs are under https://rye-up.com/guide/shims/ - it would be great to be detailed about what's missing.

One thing I can spot now is that the docs make it sound as if the python +VERSION feature requires global-python to be active, but it does not 🙂 (which is a nice feature IMO)

@MatthewScholefield MatthewScholefield changed the title Global shim docs are missing Global shim's dependency management is confusing and non-intuitive May 28, 2024
@MatthewScholefield
Copy link
Author

Ultimately, I think I realize now that rye's method of managing the global Python version isn't actually a 1:1 replacement for the normal system of managing a global Python installation. From what I understand (I may be wrong), rather than maintaining a single, global Python environment which is what most people would expect, it creates a new isolated environment for every new package.

For simple self-contained Python scripts that you want to install globally, this is amazing. However, a common reason many people use the global Python environment is for the interactive REPL and for running quick scripts that have minimal dependencies. For these purposes, the global Rye shim is not only unsuitable, but actively confusing. Here's why:

  1. python3 is quite useless since you can't actually add global library dependencies and run simple global scripts.
  2. Similarly, if you do rye install ipython, it creates a new fresh environment with only ipython removing most of the value of ipython. You can continuously run rye uninstall ipython && rye install ipython --extra-requirement numpy but this is quite cumbersome. A similar problem also exists for jupyterlab.
  3. Not knowing anything about this leads to a huge amount of confusion because you have all of the following ways of installing packages that all work in subtly different ways:
  • pip3 install ...
  • python3 -m pip install ...
  • rye install ...
  • ipython3 -m pip install ...

Now combine these on top of permutations of running rye install pip, rye install ipython, sudo apt-get install python3-pip, sudo apt-get install python3-... etc. and you can see it becomes a nightmare, especially for someone who is just getting started with Python.

Overall for these reasons, I think we really should avoid giving users an easy accidental pathway into this hell to maintain the project's mission of "A hassle-free experience for Python developers at every level." 😂

If we wanted to make this easier, I think it's possible, but it just involves building a simple supported CUJ for these use cases (ie. rye install-dep python3 numpy) and preventing people from shooting themselves in the foot with it. Personally though, I would lean towards making the whole independent-env-per-package thing be some very specific command like install-executable and leaning on a shared global env by default simply because that's kind of what the Python ecosystem has arrived upon for better or for worse.

@bluss
Copy link
Contributor

bluss commented May 28, 2024

Note that rye install is an alias for rye tools install. It's the tools feature, like a lite version of what pipx does. Rye install is not for installing packages that you import anywhere else.

That's a different feature than global shims for python which I thought this was about - best to clarify the issue.

@MatthewScholefield
Copy link
Author

MatthewScholefield commented May 28, 2024

The issue is just about the entire rye global shim experience leading to confusion. I think I might have conflated the two (good catch).

In general I think it's because it's unclear how to install dependencies on the rye-managed Python versions using global shims which would lead people to using rye install, further complicating the situation.

@bluss
Copy link
Contributor

bluss commented May 28, 2024

Good point, Rye needs to clarify that. I'm not sure what the design is, but it looks like global shims only offer python toolchains and no explicit (--system/--user type) package install. For those that only use virtualenvs, that's not a problem.

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

No branches or pull requests

2 participants