Most active commenters
  • stavros(4)

←back to thread

196 points bovem | 17 comments | | HN request time: 0.98s | source | bottom
1. stavros ◴[] No.41146736[source]
I don't understand how it's possible that we just randomly come across a project that just casually implements a Python interpreter in Rust. Don't these things take a massive amount of effort? Wouldn't this be making waves much earlier in its development process?

I feel the same way about Ruff, for example. One day it was "black all the things" and the next it's "btw we just reimplemented the entire Python formatting/linting ecosystem in Rust, and it's 100x faster, no biggie".

What's happening? Is it just so much easier to write stuff in Rust that projects like these pop out of people's heads, fully-formed? It boggles the mind.

replies(3): >>41146763 #>>41147068 #>>41148146 #
2. pansa2 ◴[] No.41146763[source]
> Don't these things take a massive amount of effort?

Yes, RustPython has been in development since at least 2018.

> Wouldn't this be making waves much earlier in its development process?

It's been posted on HN several times before: https://hn.algolia.com/?q=rustpython

replies(1): >>41147208 #
3. PaulHoule ◴[] No.41147068[source]
For me the "uv" manager has changed my Python experience because: (1) it has a correct resolver whereas "pip" certainly doesn't and I'm not sure about poetry, (2) it is crazy fast, (3) "uv" is just a binary which I can pip into my system.

(3) is important because if it was written in Javascript or Java or Python or .NET or many other languages I'd have to learn something about the runtimes of those environment to get it working. If it was written in Python it would have to deal with the bootstrapping problem that it ought to have it's own Python installation separate from the one that it is manipulating so it can't have conflicts with that environment. (e.g. how many times have I busted my poetry?) I can use "uv" or "ruff" without learning anything about Rust!

As for (2) the speed of "uv" has as much to do with better algorithms and caching as it does with being in Rust and thus much faster than Python. I think you could have done better than Poetry in Python but "uv" is transformative in that it can often build an environment in seconds or less whereas with "poetry" or "pip" or "conda" I might have time to pound out a few posts on HN. I used to avoid creating new Python environments as much as possible but now it is fast, easy, and even fun.

I bet it is more work to write "uv" in rust as opposed to a similar tool in Python but the impact on the community is so huge because we can finally put problem (1) behind us and do it with speed, reliability and grace. I had notes on how to build a better python package management system and sometimes thought about trying it but I'd become convinced that the social problem of too many people finding half-baked tools like "pip" and "poetry" acceptable was intractable. Thanks to "uv" nobody will ever have to write one.

replies(2): >>41147223 #>>41148247 #
4. stavros ◴[] No.41147208[source]
Ah ok, it's at least comforting to know that I missed it, rather than there are superhuman developers that crank these projects out in an afternoon.
replies(4): >>41147437 #>>41148352 #>>41150348 #>>41150548 #
5. stavros ◴[] No.41147223[source]
I'm really looking forward to uv being a drop-in replacement for Poetry. I don't know if that's what they're planning to do, though. Does it currently have all the niceties of Poetry (dependency management, locks, building wheels, etc?).
replies(2): >>41147340 #>>41148292 #
6. JodieBenitez ◴[] No.41147340{3}[source]
Isn't it Rye ? (https://rye.astral.sh)

"Rye supports two systems to manage dependencies: uv and pip-tools. It currently defaults to uv"

I've been evaluating it lately and it has pretty much the same CLI commands as Poetry except it's faster and comes with complete Python interpreter management (which is to me the real killer feature as I don't really care about speed of dependency resolution, but I do care about the DX).

7. tyleo ◴[] No.41147437{3}[source]
I’d wager they don’t hit major spread from opinion leaders and upvotes in social media until they are mostly usable.

It’s “I’m making a Python interpreter in rust,” claims emitted into the void with increasing engagement as it grows in usefulness.

Edit: and you can even see that in the HN search above. Every year it’s had a little more functionality and a little more engagement than the last.

8. ufmace ◴[] No.41148146[source]
A quick check on the contributors page shows ~8ish heavy contributors working over the course of 6 years and 13k commits. That's a good thing to check for any project you're thinking about integrating with IMO.

That said, my experience has been that adding business features in Rust apps is quite fast indeed!

9. charliermarsh ◴[] No.41148247[source]
(Thank you for this, it was really inspiring for me to read.)
10. charliermarsh ◴[] No.41148292{3}[source]
Yeah, that's definitely within scope for what we're trying to build, and we've been hard at work on extending uv to support those workflows (platform-agnostic resolution, lockfiles, etc.). Honestly, a lot of it is already implemented, but not yet stabilized or announced. Coming soon.
replies(1): >>41148538 #
11. fragmede ◴[] No.41148352{3}[source]
I've had some fun converting some of my Python scripts into Rust and it's really not that difficult with the help of modern tools once you wrap your head around Rust. Python is too huge to crank out in an afternoon, for sure, but on the human level, the translation from python to something compiled is a well trod path.
replies(1): >>41148433 #
12. J_Shelby_J ◴[] No.41148433{4}[source]
The one time cost of learning borrow rules and traits is steep, but the lifetime savings of cargo vs PIP probably hits break even after a few months.
replies(2): >>41148848 #>>41149602 #
13. stavros ◴[] No.41148538{4}[source]
Fantastic, I'm really looking forward to that!
14. sn9 ◴[] No.41148848{5}[source]
Not to mention the change in rate of runtime errors.
15. jbernsteiniv ◴[] No.41149602{5}[source]
Also if evolution has shown us anything we will all one day evolve into crab. Crab is the final form (Carcinisation).
16. RsmFz ◴[] No.41150348{3}[source]
I cranked out a Lua interpreter implemented in Rust in a week or two.

It only ran about 3x slower than PUC Lua... And never collected garbage either :P

17. willcipriano ◴[] No.41150548{3}[source]
Implementing a interpreter like that isn't as hard as you probably think as the standard library does a lot of the heavy lifting once you have the basics.

It's still a lot of work but the only need to make the "built in" parts of the language and that's a lot smaller subset.

Example of what im talking about: https://github.com/RustPython/RustPython/pull/3858