3 ms·
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
by stavros 2y ago
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.
- pansa2 2y ago> 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 https://hn.algolia.com/?q=rustpython
- stavros 2y agoAh 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.
- tyleo 2y agoI’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.
- fragmede 2y agoI'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.
- J_Shelby_J 2y agoThe 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.
- sn9 2y agoNot to mention the change in rate of runtime errors.
- jbernsteiniv 2y agoAlso if evolution has shown us anything we will all one day evolve into crab. Crab is the final form (Carcinisation).
- RsmFz 2y agoI 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
- willcipriano 2y agoImplementing 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 https://github.com/RustPython/RustPython/pull/3858
- PaulHoule 2y agoFor 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.
- stavros 2y agoI'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?).
- JodieBenitez 2y agoIsn't it Rye ? (https://rye.astral.sh 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).
- ufmace 2y agoA 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!