from Hacker News

RustPython: A Python Interpreter Written in Rust

by bovem on 8/2/24, 3:23 PM with 70 comments

  • by stavros on 8/3/24, 2:18 PM

    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.

  • by pornel on 8/3/24, 2:35 PM

  • by pbronez on 8/3/24, 6:32 PM

    Interesting 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

  • by nextaccountic on 8/3/24, 7:06 PM

    Does 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?

  • by upbeat_general on 8/3/24, 3:36 PM

    Does 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.

  • by nickpsecurity on 8/3/24, 6:33 PM

    I 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?

  • by pipeline_peak on 8/3/24, 4:49 PM

    If Rust makes its way into the Linux Kernel, another mature C project, I wouldn’t be surprised if a Rust interpreter replaces CPython.
  • by jeden on 8/5/24, 8:44 AM

    https://notes.eatonphil.com/lua-in-rust.html It's some kind of developer trend.
  • by Zamiel_Snawley on 8/3/24, 12:59 AM

    I 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?
  • by jbernsteiniv on 8/3/24, 10:03 PM

    Does 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.
  • by hughdbrown on 8/4/24, 3:49 PM

    There's no installable version for pyenv. In general, how well does this work with virtualenvs?
  • by abdullahalharir on 8/3/24, 4:36 PM

    Are there any benchmarks made public in comparison with the python3 interpreter?
  • by jeden on 8/3/24, 9:09 AM

    We waiting for Ruby ;)
  • by jedisct1 on 8/3/24, 2:57 PM

    A Python interpreter has to be written in every language.
  • by iamgopal on 8/3/24, 12:29 PM

    Is there GoPython ?
  • by cutler on 8/3/24, 2:56 PM

    While you're at it fix Python's crippled lambdas and ...
  • by bitzun on 8/3/24, 3:11 AM

    This 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.
  • by jdeaton on 8/3/24, 1:52 AM

    does it have a GIL