Does any sane person use python
managed by Rye 😂
#1333
Replies: 3 comments 2 replies
-
Personally I very much prefer Rye's design choices in this regard. If I want to add You have a good point about the risk of accidentally doing The way I see it is that some of the problems with Python that Rye aims to solve emerge from common usage patterns. Solving them requires both proper tooling (e.g., Rye) and changes in habits. Therefore, there is significant tension between accommodating what Python users are accustomed to and tackling the challenges the tool is meant to address. |
Beta Was this translation helpful? Give feedback.
-
@MatthewScholefield I would uno-reverse that on you and ask: "does any sane person install things into a global python environment" 😉 |
Beta Was this translation helpful? Give feedback.
-
It allows you to do uv run --with requests example.py Also, Python recently added a standard format for inline script metadata. This allows the dependencies for a script to be declared in the script itself. # /// script
# dependencies = [
# "requests<3",
# "rich",
# ]
# ///
import requests
from rich.pretty import pprint
resp = requests.get("https://peps.python.org/api/peps.json")
data = resp.json()
pprint([(k, v["title"]) for k, v in data.items()][:10]) And |
Beta Was this translation helpful? Give feedback.
-
When installing
rye
for the first time it prompts for the desired behavior when runningpython
orpython3
outside of a Rye managed project:At first, choosing the default options (Rye managed shim) seems like a no-brainer. But then I realized this catapults you into this weird state where you actually cannot use any global libraries you installed using
pip
. This means that if I have some simple script that needs a common dependency likerequests
orclick
, I can't just dopip install requests click
and thenpython3 simple_script.py
; misleadingly,pip install
succeeds but thenpython3 simple_script.py
still fails withImportError
.Similarly, if you do
pip install ipython
, and then follow up withipython3
, this will spawn Python using the system interpreter rather than the environment used bypython3
. And runningrye install ipython
orpython3 -m pip install ipython
will insert a third level of confusion.So my question, given all of this, is basically:
a. Insert a new Rye shim for
pip
so that everything in the global environment refers to the same thing (and maybe remove therye install
->rye script install
alias to reduce confusion)b. Remove the rye-managed shim from the default option on the installer
c. Something else (comment)
I know I've been vocal about this already before (#1093), but I'm bringing it up again here because this confusion is one of the core reasons why I'm hesitant to recommend rye to my fellow developer friends. As a whole, I think
rye
is a wonderful tool in the Python ecosystem and deserves to be the de facto standard. However, as it stands right now, I feel that this default rye-managed environment option will significantly confuse new Python developers making them hate Python package management even more (relevant article).Beta Was this translation helpful? Give feedback.
All reactions