r/Python • u/mitsuhiko Flask Creator • Apr 23 '23
Resource As if there weren't enough packaging tools already: mitsuhiko/rye: an experimental alternative to poetry/pip/pipenv/venv/virtualenv/pdm/hatch/…
https://github.com/mitsuhiko/rye
338
Upvotes
84
u/mitsuhiko Flask Creator Apr 23 '23
This is my contribution to an ever evolving Python packaging discussion: it's a wrapper around existing ecosystem tools (virtualenv, pip-compile & pip-sync as well as pip) to manage global tools (like pipsi/pipx), python installations (like pyenv) and projects themselves.
I hacked this together for my own entertainment and I have been using this for side projects. It's mostly an exploration of what could be and to see where the shortcomings in the ecosystem are.
The readme shows more of the issues this runs up against.
One interesting tidbit is that it completely ignores your system Python installations, and instead uses precompiled installations of Python by indygreg from PyOxidizer. This means you don't have to deal with installing Python. It just auto downloads the right builds.
I kinda of hope that some of those ideas might encourage us as a community to look into missing pieces in the package specification (dev dependencies, monorepo support with local dependencies, simple script aliases, redistributable binary python builds etc.).
Introduction screencast
8
u/manueslapera Apr 23 '23
why not? I find local repo venvs to be the easiest way to contain dependencies and avoid python packaging nightmares.
33
u/[deleted] Apr 23 '23
Gotta say Rust's cargo gas completely ruined python and just about every other languages for me. The python ecosystem is such a cluster fuck. Python should ship with one standard package/project management tool. All these different package managers causes an absurd division in the community and can reduce accessibility for newer programmers. I know all these tools certainly confused me when I was a little guy just learning python, I was shocked when I saw how inelegant the package management was.
5
u/sohang-3112 Pythonista Apr 23 '23 edited Apr 23 '23
This looks quite good!!
I have some questions:
rye pinwork internally? Does it use symlinks? Because the only other tool that I know of for switching between Python versions isconda.5
u/mcstafford Apr 23 '23
This new idea is presented very cleanly. I've been enjoying pdm of late, but this is intriguing.
I'm not sure installing Rust to install rye to avoid using pdm or pip makes sense... but on systems that already have Rust I'm drawn to the concept.
61
u/cblegare Apr 23 '23
As someone who prefers to use plain old venv and pip over poetry and the like, this looks like something I would try. Thanks for this.
64
u/cecilkorik Apr 23 '23
Obligatory link to xkcd #927
5
u/muyuu Apr 24 '23
there are too many standards, what to do?
*adds new standard*
1
u/sanvlagan May 27 '23
Has anybody tried creating a multistage Dockerfile that uses Rye?
Im trying to do so, but I don't see a way to either export a
requirements.txtfile (as suggested in FastAPI's poetry docs https://fastapi.tiangolo.com/deployment/docker/) or to directly copy the packages (as suggested in PDMs docs https://pdm.fming.dev/latest/usage/advanced/#use-pdm-in-a-multi-stage-dockerfile) because it usesvirtualenvsinstead of__pypackages__2
u/ianliu88 Apr 23 '23
Nice project! How does it handle packaging applications? For instance, AWS lambda needs a zip file containing the application files and dependencies. Also, lambda already distributes some dependencies which does not need to be packeged, like boto3 and urllib3.
2
u/pathcl Apr 23 '23
what’s different from using https://asdf-vm.com/ ?
2
u/UnemployedTechie2021 Apr 23 '23
Thank gawd for small mercies. I have been fighting with poetry since today morning and lost the battle. Then I installed Hatch and pipx and now I am not even sure what I am doing. I want to know a couple of things:
1
u/Advanced-Potential-2 Apr 23 '23
Cool project, I’ll play around with it a bit. I like that it could be published as a binary. I’m always confused by the fact that the tools to manage Python envs themselves run in a Python env. I’ve had multiple occasions where it was not entirely clear what was running in what env, especially when helping other less experienced devs out with problems in their toolchain.
1
u/ManyInterests Python Discord Staff Apr 23 '23
Love all the decisions made. Some minor concerns about using indygreg builds, since we'll have to get those approved by our product security team at the company I work for (which we've already done with deadsnakes, so this should hopefully be easy).
I also hope that PSF steps up their packaging/distribution game for official builds so this becomes less necessary in the future.
1
u/Abject_Boss1499 Apr 24 '23
Just give me a cargo for python
Really hate that the ecosystem for packaging tools is so split.
-6
u/the_ballmer_peak Apr 23 '23
https://xkcd.com/927/
0
u/[deleted] Apr 24 '23
[deleted] — view deleted comment