skillfed

attr

Simple decorator to set attributes of target function or class in a DRY way.

attr v0.3.2 441.7K downloads/30d#6,642 on PyPI10
Permissive license MIT Abandoned released

What it is and what it does

attr is a lightweight decorator for attaching metadata to Python functions and classes without repeating configuration code. It was designed to reduce boilerplate when setting Django admin field attributes like short_description and admin_order_field, allowing you to declare them once as decorator arguments instead of assigning them after function definition.

The package has been abandoned since 2022-07-13 and is now overshadowed by a more popular package that uses the same import name, creating namespace conflicts. With no runtime dependencies and a permissive MIT license, it installs cleanly, but its lack of maintenance and the naming collision make it a poor choice for new projects.

Use it for:

  • Reduce repetition when setting Django admin metadata on calculated fields without separate assignment statements.
  • Attach custom attributes to functions or classes using decorator syntax instead of post-definition assignment.
  • Legacy Django projects that need minimal decorator support for metadata attachment.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

A decorator that attaches metadata attributes to functions or classes without repeating boilerplate code.

No. The package is abandoned (last release 2022-07-13, no commits since), and namespace shadowing issues are documented in its own description. For new projects, consider alternatives. For legacy code already using attr, migration is advisable to avoid import collision.

Install

attr on PyPI

pip

pip install attr

uv

uv add attr

poetry

poetry add attr

Installing attr

Before you install

Installation is frictionless with no runtime dependencies. However, the package is abandoned—last release was 2022-07-13 with no recent repository activity.

License in practice

MIT license permits free use, modification, and distribution with minimal restrictions, suitable for both open and proprietary projects.

Quickstart

pip install attr
from attr import attr

@attr(short_description='Field', admin_order_field='real_field')
def my_calculated_field():
    pass

A popular package named attrs now shadows this module's import name; the fact sheet recommends using the dry_attr alias instead to avoid conflicts.

Verify before relying

  • Whether the namespace collision with the popular attrs package causes import or runtime issues in modern Python.
  • Whether Python 2.7 support listed in classifiers remains functional or is purely historical.
  • Current compatibility with modern Python versions given the 1493 days since last release.

Package facts

License MIT (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies none
Maintenance abandoned — 1,493 days since the last release
Last repo commit
First released
Downloads 441,722/month — #6,642 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: attr-0.3.2-py2.py3-none-any.whl

License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

function decorator metadatadjango admin field attributesdry decorator patternfunction attribute decoratorreduce boilerplate attributes
decoratorabandoneddjango

More Python Modules packages