News for hackers. Stuff that matters.
Re:PyO3: Rust Bindings for the Python Interpreter by LockAndLol on Friday January 29, 2021 @07:59AM (#25956771)
If this works well, I'd rather use this over being forced to use type hints and mypy.

Has anybody used this in conjunction with a python framework? Django, fastapi or something?

Re:PyO3: Rust Bindings for the Python Interpreter by edenhyacinth on Friday January 29, 2021 @10:37AM (#25958310)
I have! Used FastAPI as a frontend to do some minor data modification, and passed the data for model inference in Rust.

Works really nicely, although given how little work I'm doing in the Python side I honestly prefer using Rocket instead of FastAPI and then using pyo3 to call the Python library in Rust, rather than the other way around.

Re:PyO3: Rust Bindings for the Python Interpreter by LockAndLol on Friday January 29, 2021 @03:16PM (#25961836)
Thanks for the response. That does sound pretty much like what I would like to do. Have you by any chance open-sourced your project?

I'm new to rust, but I'll check out Rocket. Cheers

Re:PyO3: Rust Bindings for the Python Interpreter by uranusjr on Friday January 29, 2021 @08:17AM (#25956922)
Uh, how do you plan to use FastAPI while avoiding type hints?
Re:PyO3: Rust Bindings for the Python Interpreter by pansa2 on Friday January 29, 2021 @08:42AM (#25957116)
How would PyO3 help you avoid type hints and mypy?
Re:PyO3: Rust Bindings for the Python Interpreter by brundolf on Friday January 29, 2021 @11:07AM (#25958729)
I think the idea is that they move their business logic to the Rust code, since Rust's type system is more powerful and more sound, instead of trying to make do with MyPy
Re:PyO3: Rust Bindings for the Python Interpreter by zerkten on Friday January 29, 2021 @01:22PM (#25960520)
Wouldn't it be more of a priority to move it for lower memory use and higher request speed? A better type system is good, but often these are a struggle with scaling interpreted languages compared to other lower level languages.
Re:PyO3: Rust Bindings for the Python Interpreter by brundolf on Friday January 29, 2021 @01:30PM (#25960622)
For many people the primary appeal of Rust is its type system and related features (declaring deep immutability, pattern-matching, etc)

> often these are a struggle with scaling interpreted languages compared to other lower level languages

Not sure what's meant by this

Re:PyO3: Rust Bindings for the Python Interpreter by LockAndLol on Friday January 29, 2021 @03:14PM (#25961810)
It would minimize the python surface required to be covered with type-hints and mypy. If possible, one could simply point django to the modules generated from rust.

I'll give it a shot tonight and see how it goes. Now I'm curious.