Live data from Hacker News

RustPython

rustpython.github.io

201–210 of 244 posts

Re: RustPython

#201

I’ve been going the other way, adding rust bindings for some performance-critical code, and calling it from Python. It’s worked wonders, speeding things up 20-30x in some places. This also has the benefit of compiling to WASM if I need to, so it’s a breeze to run my code in the browser.

not sure if you use pyo3 but it works wonders

(except for some minor parts as well as the python in rust cross compilation case (last I tried ~1y ago), the rust in python cross compilation is fine tho)

Re: RustPython

#204

I’ve been going the other way, adding rust bindings for some performance-critical code, and calling it from Python. It’s worked wonders, speeding things up 20-30x in some places. This also has the benefit of compiling to WASM if I need to, so it’s a breeze to run my code in the browser.

not sure if you use pyo3 but it works wonders (except for some minor parts as well as the python in rust cross compilation case (last I tried ~1y ago), the rust in python cross compilation is fine tho)

Yeah pyo3. It also plays nicely with rust’s numpy so for a lot of deep learning applications you can load a file in rust and build your data, then pass it to python ML libraries.

Only issue I’ve had so far are some weird issues with conda versions and maturin. But those were basically my fault.

Re: RustPython

#205

Earlier quoted context omitted.

I haven't used any such slow thing yet (am mostly a commandline world person).

Don't work for a company where you need to turn in receipts or fill out info in crappy HR software? I mean, good for you and knowing the command line, but doing the less-fun, less-specialized parts of jobs usually involves regressing to the mean of what interfaces people know how to use.

I started a job in an unusual way (first week, I deployed to the Greenland ice sheet). Workday wouldn't work over the high-latency connection so I couldn't fill out my HR paperwork without VNCing into a computer in CONUS...

Re: RustPython

#206

Earlier quoted context omitted.

If you don't mind me chiming in, mostly looking for advice if you've got any. I tend to run into a lot of issues when trying to play with projects that use TensorFlow. I have an Apple Silicon laptop and I seem to always get stuck resolving circular, conflicting dependencies. The worst offender is https://github.com/magenta/magenta . It's such a cool project and I got it running once a few years ago but recently lost…

I will say that the most issues I’ve encountered with Python happened on macOS machines. The default installation was always old, and success using a modern version depended highly on the techniques used to install it. For anything that involves dependencies, I rely on venv or pyenv to create a clean environment. When on macOS, I tended to use docker/containers as well, but primarily because 99% of my Python work has…

> I will say that the most issues I’ve encountered with Python happened on macOS machines.

Same here. It's probably somewhat to do with my only partial MacOS/Homebrew knowledge, but every time I'd ressurect a Python project on MacOS, Homebrew would end up screwing up / confusing / munging the system Python and it's own ones.

Never ran into problems like that on Linux (except for that one time I tried Linux homebrew). Just something about the way homebrew does stuff seems incompatible with me understanding it. Seems to be a "just me" thing though.

Re: RustPython

#207
I was curious about how slow (or fast) it is compared to cpython. On fibonacci.py rustpython about 11x slower than cpython.

    def fib(n):
        if n == 0 or n == 1:
            return 1
        return fib(n-1) + fib(n-2)

    print(fib(35))

    time python3 ~/code/fibs.py
    14930352

    ________________________________________________________
    Executed in    1.18 secs    fish           external
       usr time    1.14 secs  180.00 micros    1.14 secs
       sys time    0.01 secs  616.00 micros    0.01 secs

    time ./target/release/rustpython ~/code/fibs.py
    14930352

    ________________________________________________________
    Executed in   13.44 secs    fish           external
       usr time   13.32 secs  175.00 micros   13.32 secs
       sys time    0.02 secs  776.00 micros    0.02 secs

Re: RustPython

#208
post #113

Earlier quoted context omitted.

I honestly don’t think I’ve ever been able to git clone any python project (that isn’t hello world equivalent), follow the readme and have it just run first shot. I’m always having to dive in and figure out which packages are missing, wrong version, etc. As I do this I find myself wondering if the repo maintainers make a habit of actually trying to set up their project from scratch just by following their readmes. I’…

Do you have any examples? I've been out of the Python game for _ages_, but can't you pretty much always just: git clone ... python -m venv venv source ./venv/bin/activate pip install -r requirements.txt Then work on that repo? Everything after "venv" is too new for me, and I've ignored it and somehow not had any issues. If there are some packages that rely on C code and don't have wheels or whatever, you need to deal…

> can't you pretty much always just:

> ...

> pip install -r requirements.txt

No. Usually that will pick up newer versions of the project's transitive dependencies, which will have breaking changes (because these days breaking changes in minor versions is what all the cool kids are doing). Since it's Python you won't find out until you hit the wrong codepath while using the program and get a runtime error.

Re: RustPython

#209
post #18

Earlier quoted context omitted.

PyPy is one of the most underrated python implementation. It just makes your pure python code 20x faster without needing to change anything ( if you don't have c++. Extension depends) We had used PyPy in production , especially on Real-time/ asynchronous web apis that doesn't need machine learning stack

If Python community and CPython developers were more open to PyPy, many things could be changed. A group of people talks about how good having a third-party interpreter in Python community while the whole Python eco-system is heavily relying on the old (maybe good-enough) Python C API. Whenever I meet a C API issue on RustPython project (yes, I contribute to RustPython), I think about PyPy, and check what's going on…

CPython is finally getting a JIT, although this change in mindset was mostly due to Microsoft and Meta.

So much time lost by not embracing PyPy.

Re: RustPython

#210

Earlier quoted context omitted.

Pretty much. Ecosystem brings most of the value than any programming language.

It's particular acute with Python. The language itself is poor - the value is in the massive ecosystem (particularly around ML). Compare this to say, Rust, where the safety guarantees are useful in their own right. There would be value in Rust even with zero packages, but I couldn't say the same for Python.

The language is easy to get started in. A half-an-hour, two-page program is easier to write and read in Python than in almost any other language. And unfortunately most programmers evaluate programming languages by writing a half-an-hour, two-page program in them.
Post reply on HN