You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
From a first impression, Rye looks pretty nice to me. However, there is one domain where I think it is going to have to innovate compared to its current "cargo-cult of Cargo" experience, and that is the REPL.
Rust projects are used in two ways:
as executables — bin crates
as libraries — lib crates
Python projects add
interactively, in a REPL, IPython REPL, Jupyter notebook, xonsh, or what-have-you.
An additional difficulty is that Rust distinguishes between bin and lib crates, but Python does not have such a distinction. Stuff like Pygments (a project we have in common 😉) ships both as a library and a CLI tool, while a Rust project would use a separate bin crate for the CLI. This leads to a challenge: I'm a bit uncomfortable with the fact that, for example, rye install pygments leaves you with a perfectly functioning pygmentize command, but after doing that, python doesn't let you import pygments; I don't know how (un)intuitive that is going to be for beginners but I suspect it might be problematic.
(I am also very uncomfortable with python being shadowed and would prefer an explicit rye python, but that is a topic for another thread.)
Unlike Rust, Python is widely used as a scripting language. I think Rye needs to embrace this to succeed. For CLI apps, total environment isolation, like Rye already does (in the same vein as pipx) is perfect; but for interactive use, you want one single environment where all your needed libraries coexist.
Say I need to download something and read it, then I realize I'll also need to plot it. I will need requests for a start, and then, while I already have my Python REPL started that I don't want to close, I want to install matplotlib and be able to import it in that REPL. Rye doesn't let me do that conveniently. I need to create a new project, which I might find weird if I didn't even intend to put my code into a file, just to throw it at the REPL.
One possible solution is to make a distinction between, say, rye install-command and rye install-in-playground, where the former is today's rye install and the latter installs stuff (normally libraries) into a single, global venv. Unlike the tightly controlled per-project venvs that need reproducibility, that global venv can be a dumpster fire where I put all the tools that are used often in REPLs like requests, numpy, matplotlib, pandas, pycowsay… to spare myself installing them every time.
Another idea, probably crazy but anyway: make the rye-provided python prompts special, allowing one IPython-like command %rye install thing that installs the module in the venv of the current interpreter, possibly temporarily. E.g., start a REPL to debug your current project, realize you've got a huge amount of data, %rye install matplotlib , plot it, exit(), and your original venv is intact. (On the other hand, if you start in the "dumpster fire" global venv, you might as well like it if the install sticks afterwards.)
There are lots of tricky design considerations, of course. I just wanted to get the ball rolling on this.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
From a first impression, Rye looks pretty nice to me. However, there is one domain where I think it is going to have to innovate compared to its current "cargo-cult of Cargo" experience, and that is the REPL.
Rust projects are used in two ways:
Python projects add
An additional difficulty is that Rust distinguishes between bin and lib crates, but Python does not have such a distinction. Stuff like Pygments (a project we have in common 😉) ships both as a library and a CLI tool, while a Rust project would use a separate bin crate for the CLI. This leads to a challenge: I'm a bit uncomfortable with the fact that, for example,
rye install pygments
leaves you with a perfectly functioningpygmentize
command, but after doing that,python
doesn't let youimport pygments
; I don't know how (un)intuitive that is going to be for beginners but I suspect it might be problematic.(I am also very uncomfortable with
python
being shadowed and would prefer an explicitrye python
, but that is a topic for another thread.)Unlike Rust, Python is widely used as a scripting language. I think Rye needs to embrace this to succeed. For CLI apps, total environment isolation, like Rye already does (in the same vein as pipx) is perfect; but for interactive use, you want one single environment where all your needed libraries coexist.
Say I need to download something and read it, then I realize I'll also need to plot it. I will need
requests
for a start, and then, while I already have my Python REPL started that I don't want to close, I want to installmatplotlib
and be able to import it in that REPL. Rye doesn't let me do that conveniently. I need to create a new project, which I might find weird if I didn't even intend to put my code into a file, just to throw it at the REPL.One possible solution is to make a distinction between, say,
rye install-command
andrye install-in-playground
, where the former is today'srye install
and the latter installs stuff (normally libraries) into a single, global venv. Unlike the tightly controlled per-project venvs that need reproducibility, that global venv can be a dumpster fire where I put all the tools that are used often in REPLs likerequests
,numpy
,matplotlib
,pandas
,… to spare myself installing them every time.pycowsay
Another idea, probably crazy but anyway: make the
rye
-providedpython
prompts special, allowing one IPython-like command%rye install thing
that installs the module in the venv of the current interpreter, possibly temporarily. E.g., start a REPL to debug your current project, realize you've got a huge amount of data,%rye install matplotlib
, plot it,exit()
, and your original venv is intact. (On the other hand, if you start in the "dumpster fire" global venv, you might as well like it if the install sticks afterwards.)There are lots of tricky design considerations, of course. I just wanted to get the ball rolling on this.
Beta Was this translation helpful? Give feedback.
All reactions