Attrs

screenshot of Attrs

Python Classes Without Boilerplate

Overview

attrs is a Python package that aims to make writing classes easier by eliminating the need to implement object protocols. It provides a class decorator and a way to declaratively define attributes, allowing for concise and correct software development without sacrificing code performance.

Features

  • Class decorator for easy attribute declaration
  • Concise and explicit overview of class attributes
  • Human-readable repr method
  • Equality-checking methods
  • Initializer method
  • Optional type annotations with attrs.field()
  • Modern APIs introduced in version 20.1.0
  • Compatibility with classic APIs and attr package import