Attrs – The One Python Library Everyone Needs

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SonarLint - Deliver Cleaner and Safer Code - Right in Your IDE of Choice!
  • Scout APM - Less time debugging, more time building
  • SaaSHub - Software Alternatives and Reviews
  • pydantic

    Data parsing and validation using Python type hints

    Pydantic is dataclasses, except types are validated at runtime? It's nice and looks just like a normal dataclass looking at https://pydantic-docs.helpmanual.io/

    For any larger program, pervasive type annotations and "compile" time checking with mypy is a really good idea though, which somewhat lessens the need for runtime checking.

  • dataclasses

    dataclasses was explicitly inspired by attrs. https://github.com/ericvsmith/dataclasses/issues/1

  • SonarLint

    Deliver Cleaner and Safer Code - Right in Your IDE of Choice!. SonarLint is a free and open source IDE extension that identifies and catches bugs and vulnerabilities as you code, directly in the IDE. Install from your favorite IDE marketplace today.

  • CPython

    The Python programming language

    This is only remotely relevant but I recently learned that the related `dataclasses` id implemented by constructing _string representations_ of functions and calling `exec` on them.

    https://github.com/python/cpython/blob/3.10/Lib/dataclasses....

    Kind of blew my mind

  • traits

    Observable typed attributes for Python classes (by enthought)

    My favourite among this class of Python libraries has been traits from Enthought:

    https://github.com/enthought/traits

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts