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

Summary

attrs is a Python package that simplifies the process of writing classes by providing a class decorator and declarative attribute definition. It offers features such as concise attribute overview, human-readable repr method, equality-checking methods, and initializer method. It also supports optional type annotations and is compatible with both modern and classic APIs. attrs aims to improve software development efficiency without compromising runtime performance.