8 ms·
RustPython: A Python Interpreter Written in Rust
- bitzun 2y agoThis project doesn't seem to be adhering to the terms of the license of the original CPython modules that have been copied into its source repository.
- bee_rider 2y agoWhat are they violating, out of curiosity?
- timeinput 2y agoThey list the repository as MIT licensed, but the python modules are distributed under the Python Software License which says: 2. Subject to the terms and conditions of this License Agreement, PSF hereby grants Licensee a nonexclusive, royalty-free, world-wide license to reproduce, analyze, test, perform and/or display publicly, prepare derivative works, distribute, and otherwise use Python alone or in any derivative version, provided, however, that PSF's License Agreement and PSF's notice of copyright, i.e., "Copyright (c) 2001-2024 Python Software Foundation; All Rights Reserved" are retained in Python alone or in any derivative version prepared by Licensee.
- deleted 2y ago[deleted]
- Zamiel_Snawley 2y agoI don’t see it on the main read me, what are the limitations/incompatibilities with CPython at this point in time? How “drop in ready” is it?
- fastball 2y agoThey have a "What's Left?"[1] and the results of running RustPython against the CPython test suite[2] up on the website. [1] https://rustpython.github.io/pages/whats-left https://rustpython.github.io/pages/whats-left [2] https://rustpython.github.io/pages/regression-tests-results.html https://rustpython.github.io/pages/regression-tests-results....
- snthpy 2y agosqlite3 is the main one on that list that jumps out at me.
- deleted 2y ago[deleted]
- rty32 2y agoThis seems very weird to me. Anyone who is just slightly interested in the project would want to know if specs are fully implemented and this has parity with the "official implementation". Can't believe it's not in README.
- kalger 2y ago[flagged]
- jdeaton 2y agodoes it have a GIL
- galdosdi 2y agoidk but Jython didn't. So I don't think there's anything inherent in the language outside of CPython that calls for it.
- Lvl999Noob 2y agoIirc, it mostly impact C modules in terms of the guarantees that are offered / not offered with GIL / NOGIL.
- amelius 2y agoYeah, but the ecosystem of C modules is what makes Python so great.
- bmitc 2y agoIt's what makes Python tolerable.
- galangalalgol 2y agoThere is a competing c interface that numpy and a few other projects are adopting that allows for no gil. Last time this came up I thought the rust implementation used that one.
- Tuna-Fish 2y agoThe complete semantics of Python object lifetime are expensive to implement in a compatible manner without a GIL. Jython got around this by not doing it, making it not fully compatible (yes, people do depend on objects being eagerly freed), just using the JVM GC instead. If you do want full compatibility, the choice is between single-threaded performance and parallelism.
- 2y ago
- jeden 2y agoWe waiting for Ruby ;)
- Alifatisk 2y agoLookup Artichokeruby
- iamgopal 2y agoIs there GoPython ?
- desdenova 2y agohopefully not
- tekknolagi 2y agoYes and it's called grumpy
- ck45 2y agoThere is, https://github.com/go-python/gpython https://github.com/go-python/gpython
- stavros 2y agoI 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.
- pornel 2y agoThe logo is perfect: https://github.com/RustPython/RustPython/blob/main/logo.png https://github.com/RustPython/RustPython/blob/main/logo.png
- cutler 2y agoWhile you're at it fix Python's crippled lambdas and ...
- JohnKemeny 2y agoWhat's wrong with Ellipsis?
- KolenCh 2y agoI wonder why you stops there midway in a sentence and only after reading the other comments I get what you mean … What problems you are referring to exactly, and how would they be fixed as an implementation but not at the language level?
- jedisct1 2y agoA Python interpreter has to be written in every language.
- haspok 2y agoJust as Doom runs on about any hardware you can think of.
- upbeat_general 2y agoDoes this have faster startup times than cpython? Every time I want to rewrite a shell function in python, I always hesitate due to the slow startup.
- actinium226 2y agoHow fast does it really need to be? On my M2 macbook air: $ time A=1 B=1 python -c "import os; print(int(os.getenv('A'))+int(os.getenv('B')))" 2 real 0m0.068s user 0m0.029s sys 0m0.026s
- wredue 2y agoEh. Once you start using imports, python slows down dramatically. So I guess it really just depends what your scripts use.
- KolenCh 2y agoRegarding import cost, as it’s doing heavy IO traversing the file system, the cost heavily depends on how fast you can do IO in the hardware, and also the file system (and the OS). So a fast SSD will help, and somewhat surprisingly putting it inside docker helps (in an HPC context, not so sure it’s implications here as we’re talking about a short scripts.) But the context here is to port shell scripts to Python, I’m not sure how huge amounts of imports matters. And it is probably an intrinsic problem of the language, unless we start talking about compiling (and somehow statically) not interpreting the Python program, whichever implementation of the language probably won’t help the situation. Lastly, if high startup costs of the script becomes relevant, perhaps it is orchestrating wrong. This is an infamous problem of Julia, and their practice is then just keep the Julia instance alive and use it as “the shell”. Similarly, you can do so in Python. Ie rather than calling a script from the shell acting on millions of things, write a wrapper script that start the Python instance once. Memory leak could be a problem if it or its dependencies are not well written but even in that case you have ways to deal with that.
- 2y ago
- abdullahalharir 2y agoAre there any benchmarks made public in comparison with the python3 interpreter?
- pipeline_peak 2y agoIf Rust makes its way into the Linux Kernel, another mature C project, I wouldn’t be surprised if a Rust interpreter replaces CPython.
- pbronez 2y agoInteresting that it relies on OpenSSL, either dynamically from the OS or vendored at compile time. I wonder what the implications would be for using something like rustls. You’d get TLS batteries included and kill a large external dependency… but possibly introduce behavior changes to low-level cryptographic operations, which is scary. Still, the maintainers stated that they don’t plan to implement Python’s readline module because they already have a rust implementation of readline. A similar argument could apply here - use native rust implementations of dependencies and expose them via the expected Python APIs. This would break some ambitious Python programs, but those probably wouldn’t consider alternative runtimes anyway. https://github.com/rustls/rustls https://github.com/rustls/rustls
- nickpsecurity 2y agoI wonder if this would make Python web applications more secure at interpreter and library level. Running it on hardened Linux, OpenBSD, or FreeBSD was a start. A Rust implementation might help. I also miss setups like eCos RTOS where a GUI determined which features got compiled in. Strip each Python app down to just what it needs in the interpreter. Might squeeze it in L1-L2 cache that way, too. Aside from embedded (eg MicroPython), has anyone anything like that for use on servers?
- nextaccountic 2y agoDoes numpy runs on rustpython? And other libraries used in ML (not expecting compatibility with huge libraries like torch or tensorflow, but rather, getting the leaves to work should be doable) If not, is it at all possible to get numpy to work and other libraries written in native code? I see that rustpython also work in wasm: but what about compiling numpy's native code to wasm as well?
- jbernsteiniv 2y agoDoes RustPython support the GIL? It would be ironic for a language with a crab as a mascot to not depend on having gills or at least one.
- hughdbrown 2y agoThere's no installable version for pyenv. In general, how well does this work with virtualenvs?
- jeden 2y agohttps://notes.eatonphil.com/lua-in-rust.html https://notes.eatonphil.com/lua-in-rust.html It's some kind of developer trend.