Advanced PyO3: Creating A Python CLI With RUST

  Рет қаралды 6,916

Isaac Harris-Holt

Isaac Harris-Holt

Күн бұрын

Пікірлер: 25
@AbdolaMike
@AbdolaMike 8 ай бұрын
great video! I also never heard of Typer, but I'll definitely check it out as well! looking forward to watching some of your other videos!
@IsaacHarrisHolt
@IsaacHarrisHolt 8 ай бұрын
Thanks! Glad you found it useful!
@patricks7611
@patricks7611 6 ай бұрын
Typer is the best. I wish every language had a Lib with which one can create beautiful cli interfaces so easy.
@IsaacHarrisHolt
@IsaacHarrisHolt 6 ай бұрын
100% agree. There are some good options, but you're generally limited to languages that offer macros or runtime reflection like Python or Rust. You could potentially build something like it in Go, too
@haydn.murray
@haydn.murray Жыл бұрын
Sick video! - Great content, educational and at the right depth
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
Thank you! I'm glad you found it useful
@kovlabs
@kovlabs Жыл бұрын
that was really excellent!
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
Thank you! I'm glad you found it helpful
@skyline00069
@skyline00069 Жыл бұрын
rust is the future.
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
It's definitely a big part of it!
@treythomas7647
@treythomas7647 Жыл бұрын
Use clap crate and create the cli tool in rust
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
This is definitely doable! However, there are cases where you only want a small portion of the CLI tool to be written in Rust. If you're mostly relying on network calls, then writing in Python is fine, and probably faster. You can then just rewrite a tiny bit in Rust for data processing, for example. The example in this video only shows the Rust side, but I mostly wanted to demonstrate the interop and teach people about the tools :)
@ChrisHalden007
@ChrisHalden007 Жыл бұрын
Great video. Thanks
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
You're welcome! I hope you learned something :)
@DJenriqez
@DJenriqez Жыл бұрын
Can you also make tutorial, for work with something more advanced ? Like, creating socket connection in rust, and send events to python, or maybe bind something like actix-web/rocket,... ? building computing pipeline like for example pytorch make ?
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
Interesting ideas! I'm not sure there'd be much benefit in binding to a long-running Rust process like Actix or Rocket, as they don't tend to have much information to pass around, and ultimately you'd just be starting the process from Python. Could you elaborate on the computing pipeline for Pytorch?
@cameronysidron2662
@cameronysidron2662 7 ай бұрын
How much quicker is this than just using python?
@IsaacHarrisHolt
@IsaacHarrisHolt 7 ай бұрын
Substantially quicker, unless you use C libraries like numpy (for this specific example). Take a look at speedups introduced by tools like Ruff and Pydantic V2 and you'll see :)
@oliverli9630
@oliverli9630 10 ай бұрын
build Rython (vs Cython) that can translate my python code to rust by just running a `setup.py` please! so that we can just freely code in python without worrying about rust's complex syntax, ownership, lifetime and whatnot. before that happens, or Mojo becomes general-purpose and production ready, Cython is still the king
@IsaacHarrisHolt
@IsaacHarrisHolt 10 ай бұрын
Interesting concept! Unfortunately, even if you transpile it to Rust, you'll still have to deal with the borrow checker, or the Rust won't compile. The way to get around that would be cloning everything and using wrappers, at which point you might as well just write the Rust.
@IsaacHarrisHolt
@IsaacHarrisHolt 10 ай бұрын
Also, Rython is a Ruby integration for Python 😉
@oliverli9630
@oliverli9630 10 ай бұрын
@@IsaacHarrisHolt haha, fascinating opensource world! didn't know that Rython is there. i believe somebody will find a way some day haha
@IsaacHarrisHolt
@IsaacHarrisHolt 10 ай бұрын
Perhaps! It would be great
@Red-bg8xg
@Red-bg8xg Жыл бұрын
at this point, just write the cli in rust and drop python all together 😂
@IsaacHarrisHolt
@IsaacHarrisHolt Жыл бұрын
This was mostly an example! Also the Typer library is fantastic for CLIs, and would make it easier to expand this in future with other functionality that doesn't have the same performance requirement
This Python Linter Is TOO Fast
4:17
Isaac Harris-Holt
Рет қаралды 1 М.
Combining Rust and Python: The Best of Both Worlds?
11:08
ArjanCodes
Рет қаралды 75 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН
How To Make Your Python Packages Really Fast With RUST
5:16
Isaac Harris-Holt
Рет қаралды 43 М.
Rust Demystified 🪄 Simplifying The Toughest Parts
14:05
Code to the Moon
Рет қаралды 192 М.
Don't Use Pip For Big Projects - Use These Instead
7:56
Isaac Harris-Holt
Рет қаралды 26 М.
Zig for the Uninitiated: Pointers, Arrays, and Slices
19:03
Tyler Calder
Рет қаралды 2,6 М.
Your backend is too complicated
9:47
Isaac Harris-Holt
Рет қаралды 94 М.
Ruff is the FUTURE of Python development
14:25
Carberra
Рет қаралды 139 М.
Rust Data Modelling Without Classes
11:25
No Boilerplate
Рет қаралды 184 М.
Calling Rust code from Python
8:23
Let's Get Rusty
Рет қаралды 40 М.
How to use PyO3 to write Python extensions in Rust
7:05
InfoWorld
Рет қаралды 4,8 М.
Rust Powered Polymorphism ⚡️ With Traits
9:55
Code to the Moon
Рет қаралды 107 М.
The Lost World: Living Room Edition
0:46
Daniel LaBelle
Рет қаралды 27 МЛН