PyO3: From Python to Rust and Back Again (with David Hewitt)

preview_player
Показать описание
There’s huge pressure on Python at the moment to get faster, ideally without changing at all. One increasingly–popular way of achieving that impossible task is to push the performance critical code down into C, C++, or Rust. And this week we’re focussing on the Python route, as we take a look at PyO3.

David Hewitt’s the principal committer to PyO3, and he joins us to go through the easy parts, the hard parts, and the works in progress, giving us an insight into how Python and Rust work under the hood, and quite how much work it takes to make them work as one.



--

0:00 Intro
3:09 How David Got Involved in PyO3
7:01 So Starting With Python To C...
9:20 Taking That To Rust
17:37 Calling Rust from Python
20:54 Understanding PyO3's Place In The Stack
21:52 Memory Safety
30:37 Rust's Lifetimes
35:07 Applying Lifetimes to Python Code
38:24 Let's Get Into Error Handling
55:55 The Performance Cost
1:01:19 Threading
1:16:05 David's Motivations
1:19:22 Supporting Python's Sub-Interpreters
1:24:14 The Limits of Compile-Time Guarantees
1:27:32 Getting Started with PyO3
1:33:01 Outro
Рекомендации по теме
Комментарии
Автор

The man, the legend himself, thanks for the great work. PyO3 introduced Rust to me some years ago, and I will be forever grateful for such a smooth experience.

lycantropos
Автор

It would be great to see you interviewing Casey Muratori.

Casey holds a lot of knowledge about game development and low level code. I suppose a portion of your audience would enjoy lisening to him.

I really enjoy the way you interview people. You’ve got real coding experience and you inspire your guests to talk about their technical solutions. It has depth in it.

Casey is advertising his new course with cool stuff about low level language and CPU architecture. He keeps going to « young » interviewers that can’t extract the depth like you do.

victoroliari
Автор

My first Rust project was using PYO3 and I was amazed by how quickly you can learn by doing. Great job David and all the others working on PYO3!

michaelscofield
Автор

This channel deserves a lot more subscribers.

MultiMojo
Автор

Really love the new detailed chapter markers. 👍

itopaloglu
Автор

This project, PyO3, is the life-changing one. I was really surprised, that even async Rust functions work too. Wonderful job, David!

linkernick
Автор

Very interesting (and sympathetic) talk!

phononify
Автор

I've always feared that someday, someone would pronounce "numpy" like that

jamesarthurkimbell
Автор

PyO3 is exciting, as it Mojo. I've used cpp and python ctypes to remove python in hotspots of programs before, I wouldn't say it was painful but the learning curve was there and works well once it works. Low friction interop between Python and performant compiled languages offers something superior to a Python4. Imagine being able to call, cpp, rust, go, zig, mojo all from python as first class functionality...

cj-ipzh
Автор

I’ve been a Spotify listener for awhile now; this is an excellent episode of an excellent show.

faldarith
Автор

Another great episode! Getting Charlie Marsh would be an amazing interview and follow up to this!

MrHopp
Автор

There is rye build system written in rust and its being developed by flask's (web micro-framework for python) author. Currently, its maintained under astral

vikaspoddar
Автор

Will we be getting a python + zig interop episode next?

vikingthedude
Автор

My 2 cents. Another compelling use case for PyO3 is when you have a Rust library implementing some complex logic that you need to share with various levels of your stack. PyO3 allows you to wrap an already complete, full featured, tested Rust library with a Python API with minimal effort.

driedurchin
Автор

Could you do an interview with the creator of the C3 language? It is a C alternative that fits in a similar spot to Odin and Zig.

frankc
Автор

Combine python dependency concerns with rust borrow checker and async? Heaven.

SirSomnolent
Автор

Can you workout a podcast episode with the devs of rustpython interpreter

vikaspoddar
Автор

Absolutely terrific interview but it makes me thinking... excluding DS and researchers... maybe, just maybe... we should stop asking half of the C, C++ and Rust community to write the heavy lifting code, so the other half can keep using Python?

DArea