Skip to main content

15 docs tagged with "metaprogramming"

View all tags

__set_name__ - The Descriptor Naming Protocol

Understand __set_name__, Python's descriptor self-naming protocol - how it eliminates name redundancy, how type.__new__ calls it, and how Django, Pydantic, and SQLAlchemy use it to build self-configuring field systems.

Custom ORM Core

Build a mini SQLAlchemy-style ORM using metaclasses, descriptors, and __set_name__ to map Python classes to database tables.

Metaclasses - The Class of Classes

Understand type as the metaclass of all classes, the full class creation pipeline, __new__, __init__, __call__ on metaclasses, __prepare__, metaclass inheritance and conflicts, and real-world usage in Django, SQLAlchemy, and ABC.

Module 01 - Metaprogramming Overview

Master the machinery that powers every serious Python framework - metaclasses, descriptors, __init_subclass__, __set_name__, dynamic class creation, and import hooks. Write code that writes code.

Plugin Framework

Build an auto-discovering plugin system using __init_subclass__, class registries, and import hooks.