attrs
Classes Without Boilerplate
Install
attrs on PyPI
pip
pip install attrsuv
uv add attrspoetry
poetry add attrsPackage facts
| License | MIT (permissive) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | none |
| Maintenance | actively maintained — 147 days since the last release |
| First released | |
| Popularity | one of the 100 most-downloaded packages on PyPI (30-day window, as of 2026-08-13) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-13) |
Evidence: attrs-26.1.0-py3-none-any.whl
Keywords: attribute, boilerplate, class
About attrs
from the package's own PyPI description — quoted content, verbatim
<p align="center"> <a href="https://www.attrs.org/"> <img src="https://raw.githubusercontent.com/python-attrs/attrs/main/docs/_static/attrs_logo.svg" width="35%" alt="attrs" /> </a> </p>
attrs is the Python package that will bring back the joy of writing classes by relieving you from the drudgery of implementing object protocols (aka dunder methods). Trusted by NASA for Mars missions since 2020!
Its main goal is to help you to write concise and correct software without slowing down your code.
Sponsors
attrs would not be possible without our amazing sponsors. Especially those generously supporting us at the The Organization tier and higher:
<!-- sponsor-break-begin -->
<p align="center">
<!-- [[[cog import pathlib, tomllib
for sponsor in tomllib.loads(pathlib.Path("pyproject.toml").read_text())["tool"]["sponcon"]["sponsors"]: print(f'<a href="{sponsor["url"]}"><img title="{sponsor["title"]}" src="https://www.attrs.org/en/26.1.0/_static/sponsors/{sponsor["img"]}"...
AI interpretation — verify before relying
AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page
attrs is a Python library that automatically generates boilerplate methods like `__init__`, `__repr__`, and `__eq__` for classes, letting you define attributes declaratively with type annotations or field descriptors.
Installation is frictionless: attrs is a pure-Python package with no runtime dependencies, distributed as a wheel, and actively maintained with a recent release (147 days ago).
attrs is licensed under MIT, a permissive license that allows commercial and private use with minimal restrictions—suitable for most projects.
Usage
pip install attrs
from attrs import define, Factory
@define
class Point:
x: int
y: int = 0
p = Point(1, 2)
print(p) # Point(x=1, y=2)
Requires Python 3.9 or later.
Verdict: attrs is a mature, zero-dependency library (top 100 on PyPI) with active maintenance, no known vulnerabilities, and permissive licensing. It is production-ready and trusted by NASA; the main decision is whether declarative class generation fits your codebase's style.
Needs verification
- Performance characteristics compared to standard dataclasses or manual implementations for your specific use case.
- Whether the modern `@define` API or classic `@attr.s` API is recommended for new projects.
Similar packages
permissive · top 1,000 on PyPI
structlogpermissive · top 1,000 on PyPI
blackpermissive · top 1,000 on PyPI
argon2-cffipermissive · top 1,000 on PyPI
Deprecatedpermissive · top 1,000 on PyPI
fastapipermissive · top 100 on PyPI
xgboostpermissive · top 1,000 on PyPI
importlib-metadatapermissive · top 100 on PyPI
anyiopermissive · top 100 on PyPI
marshmallowpermissive · top 1,000 on PyPI