Skip to content
0:00 / 0:00

#pydantic#data-validation#pyo3

Talks - Samuel Colvin: How Pydantic V2 leverages Rust's Superpowers

PyCon US

34K subscribers • 26 videos on Hallway • Conference channel

YouTube
  • One of the most-watched uploads on PyCon US, a conference or university channel Hallway lists. Nobody has recommended it in the communities yet, so it ranks below community picks.
  • Presented by Samuel Colvin

Intermediate. Assumes working knowledge.

10K views3 years ago

Programming languagesSystems programmingPythonRustPerformance and optimization

Samuel Colvin explains how rebuilding Pydantic's core validation and serialization logic in Rust significantly improved its performance.

Pydantic is a data validation library for Python that has seen massive adoption over the last few years - it is estimated that Pydantic is now used by about 10% of professional web developers! Over the last year I've been working full time to rebuild Pydantic from the ground up, using Rust for virtually all the validation and serialization logic. Pydantic V2, with these changes included, has recently been released. In this talk I will give a brief introduction to Pydantic and the new features in Pydantic V2 before diving into how the use of Rust has allowed us to completely change the architecture of Pydantic to make it easier to extend and maintain while also improving performance significantly. The majority of the talk will be devoted to using examples from the pydantic V2 code base to demonstrate the advantages (and disadvantages) of writing libraries like Pydantic in Rust. I'll cover the real life trade-offs and design decisions you might face while implementing logic in Rust rather than Python. This talk should be interesting to any Python developer who's interested in combining Python and Rust - no knowledge of Rust or Pydantic is required. However if you'd like to get some context or learn more about the topics discussed, here are some useful resources: Pydantic V2 Plan - blog post about the plan for Pydantic V2 pydantic-core - the python package that provides Rust logic in pydantic PyO3 docs - the amazing library that allows Rust to be embedded in Python Build your Python Extensions with Rust! by Paul Ganssle - good intro to building Python extensions in Rust

Why it's here

A top upload from a listed channel

PyCon US is on Hallway's list of conference and university channels, and this upload is one of its most-watched talks or lectures. Nobody has recommended it in the communities yet, so it ranks below community picks.