What is the Python Abstract Syntax Tree and why should you care? In this talk, we’ll demystify the Abstract Syntax Tree (AST) and show how it powers tools you probably already use - in Python and other languages.
We’ll take a close look at pytest assert rewrite as an motivating and empowering example of how AST transformations work.
ASTs (and their cousins, the Concrete Syntax Trees) drive many real-world applications, from linters to automatic refactoring. We’ll mention some modern tools you might want to use.
Armed with newfound confidence, we’ll explore more creative transformations.
You’ll leave this talk with a deeper understanding of Python’s internals and a few terrible ideas for AST-powered tools.
This talk is beginner-friendly, no prior AST knowledge required.
Speaker
Laurent Direr
I’m a freelance web developer helping small teams ship reliable software. I’ve been working with Python for 10+ years and enjoy automating work for other developers.
These days I’m very interested in local-first software technologies. I attended the Recurse Center (a programming retreat) in 2018.