1 repositorio
Runs custom callbacks whenever an attribute is set after initialization, enabling validation, conversion, or freezing.
Distinct from Attribute Lifecycle Hooks: Distinct from Attribute Lifecycle Hooks: focuses on post-initialization attribute setting, not general lifecycle interception.
Explore 1 awesome GitHub repository matching web development · Attribute Setting Hooks. Refine with filters or upvote what's useful.
attrs is a Python library that automatically generates initialization, representation, equality, hashing, and ordering methods from declarative class attribute definitions. At its core, it provides a class decorator metaprogramming framework that intercepts class creation to rewrite the class body, producing dunder methods without manual boilerplate. The library includes a comprehensive attribute validation toolkit with built-in validators for type checks, range constraints, regex matching, length limits, and logical composition of validation rules. The library distinguishes itself through it
Runs custom callbacks on attribute assignment for validation, conversion, or freezing.