Comment on Compiling typed Python: types are very broad hints and they are sometimes lies.

<- View Parent
Turun@feddit.de ⁨9⁩ ⁨months⁩ ago

I never used C, so I don’t know how easy it is there.

In rust there is a library that takes care of all the details (PyO3), so you only need to add #[pyclass] or #[pymethod] above your structs and methods, define what the module/submodule/classes/functions is and run the tool provided by the PyO3 library to compile the code and install it in a local virtual environment.

So it’s literally (the actual meaning of literally) just two lines for every class or method you want to have available in python and ten lines in the Cargo.toml/pyproject.toml config files.

This article shows the basic usage.

source
Sort:hotnewtop