Talks: Deep dive into code generation: from text templates to ORM-like approach

Friday - April 21st, 2023 1:30 p.m.-2:15 p.m. in

Presented by:

Experience Level:

Advance experience


Numerous Python projects are using code generation to free their users from repetitive work (with Django and attrs / dataclasses being notable examples). At the same time code generation is far from being a well known technique among Python developers.

In the talk I'll explore the current status quo of code generation in Python in terms of usecases and tooling. We'll discuss what can be improved, and learn new approaches from other languages. We'll look into Python internals to see how code is represented. We will learn how to use stdlib tools to make code generation more flexible. Finally I'll share my experience with Python code generation the led me to writing my own tool, and implementing macros and code transformations along the way.