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.
Embedded Rust CLI - Rust Tutorial
From the course: Using Rust with Python
Embedded Rust CLI
- [Instructor] Here's a Rust project that I have embedded Python inside. And I'm also going to make it into a command line tool here. And let's go ahead and look at the structure here without any build artifacts. I have the cargo files here, I have a make file, and then I have two files inside of source. So I have a lib.rs and a main.rs. As a side note here, this is a great command tree -I target to find exactly the structure of a Rust project without having to look at the target build. Now if we go ahead and look inside of the lib file first, we can take a look at what's happening. So first up here I have some library code that embeds Python. So this is where there is some Python code that accepts an input. In this case, the input is Marco and it returns back Python if there's Marco. Next, what we do here is we have the Python interface here, we also have the GIL that is being released and then we're able to talk to that function, capture it, and then put input into it and then…
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
-