From the course: Using Rust with Python
Unlock this course with a free trial
Join today to access over 23,200 courses taught by industry experts.
Run Python with embedded Rust - Rust Tutorial
From the course: Using Rust with Python
Run Python with embedded Rust
- PyO3 also can use embedded Python from Rust. And this is very powerful because if you already have scripts for example, or library code in Python, or maybe you have some little bits of algorithms or custom logic, business logic, and you want to use it within the confines of Rust, do command line tools, microservices, serverless functions, a great way to think about this would be to put that piece of Python as a full script. Maybe it's already tested. You're really, you know, confident about the ability of this Python code and leverage the Rust ecosystem. So you can see here pretty straightforward, build out a function, use this PyO3, prepare free threaded Python, use Python with the gill so you release the gill and then put your code inside. Now what's interesting as well is that PyO3 can interact with functions and even call them and send input, which is pretty exciting. So let's go ahead and take a look at how that would work. All right, here we have a layout for Marco Python…
Contents
-
-
Introduction: Instructor45s
-
Introduction: Rust and Python5m
-
PyO3 installation4m 15s
-
(Locked)
Basic Rust library4m 46s
-
(Locked)
Rust to Python3m 33s
-
(Locked)
Rust ownership model4m 59s
-
(Locked)
Diagram of a PyO3 project3m 40s
-
(Locked)
Python calculator CLI3m 54s
-
(Locked)
PyO3 features2m 38s
-
(Locked)
PyO3 exceptions4m 21s
-
(Locked)
Call Python from Rust5m 53s
-
(Locked)
Run Python with embedded Rust4m 47s
-
(Locked)
Embedded Rust CLI diagram3m 34s
-
(Locked)
Embedded Rust CLI4m 31s
-
(Locked)
Embedded Rust CLI test4m 59s
-
(Locked)
Rust-built Python tools3m 52s
-
(Locked)
Using the Rust Ruff linter5m 15s
-
(Locked)
Using Polars in Python with Rust4m 9s
-
(Locked)
Polars CLI in Rust4m
-
(Locked)
Polars CLI test in Rust4m 21s
-
(Locked)
Polars CLI integration test3m 29s
-
(Locked)
Polars criterion benchmarking5m 39s
-