--- id: fields version: "5.0.0" license: BSD license_treatment: permissive maintenance: abandoned --- # fields — Container class boilerplate killer. License: permissive · Maintenance: abandoned · Downloads: 78.8K/mo ## What it is and what it does Fields is a lightweight library for defining container classes—objects that hold a fixed set of named attributes—without writing repetitive `__init__`, `__repr__`, and comparison methods. You define a class by chaining attribute names as class attributes (e.g., `class Pizza(Fields.name.size)`), and Fields automatically generates the initialization logic, a readable string representation, and all comparison operators. It supports both positional and keyword arguments, optional fields with default values, and can generate tuple subclasses for immutable containers. The package positions itself as a middle ground between namedtuple (which is verbose and inflexible) and decorator-based approaches like attrs or characteristic (which impose constraints on how you write `__init__`). Fields lets you override methods normally—including `__init__`—without the framework fighting you. However, the project has been abandoned since 2016 and is untested on modern Python versions, making it a legacy choice for new code. Use it for: - Define simple immutable data structures (using Tuple base) as a more readable alternative to namedtuple for small projects. - Create lightweight container classes for function return values or intermediate data without writing boilerplate comparison and repr methods. - Build tree or graph node classes with optional fields and defaults (e.g., binary tree nodes with left/right children defaulting to None). - Prototype data models quickly when you need a class with fields but don't want decorator syntax or external dependencies. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Generates lightweight container classes with automatic `__repr__`, comparison methods, and field initialization from a fluent attribute-chain syntax, eliminating boilerplate for simple data holders. No, not for new projects. While the package is stable and has no known vulnerabilities, it has been abandoned since 2016 with no maintenance or Python 3.8+ testing. Modern alternatives like dataclasses (standard library in Python 3.7+) or attrs are actively maintained, better integrated with type checkers, and offer richer features. Install only if you are maintaining legacy code that already depends on it. ## Install pip install fields uv add fields poetry add fields ## Installing fields Before you install: Installation is frictionless (pure Python wheel, no runtime dependencies). However, the package is abandoned—last release was 2016-04-13 and last commit 2021-11-11—so it will not receive bug fixes or support for modern Python versions beyond what was already compiled in. License in practice: BSD license (permissive) imposes no significant restrictions on use, modification, or redistribution in most contexts. Quickstart: from fields import Fields class Pizza(Fields.name.size): pass p = Pizza("Pepperoni", "large") print(p) # Pizza(name='Pepperoni', size='large') Package is abandoned and untested on Python versions released after 2016; compatibility with modern Python (3.8+) is unverified. Verify before relying: - Whether the package works reliably on Python 3.8 and later without modification or workarounds. - Whether the fluent attribute-chain syntax (e.g., `Fields.name.size`) works as documented in all Python implementations listed in classifiers. ## Package facts - License: BSD (permissive) - Python support: unspecified - Install friction: low - Maintenance: abandoned - Downloads: 78.8K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags container class boilerplate, automatic repr and equality, lightweight data class, field initialization syntax, namedtuple alternative, class decorator-free fields, simple object containers, legacy, data-structures [View on SkillFed](https://skillfed.io/packages/fields) · [View on PyPI](https://pypi.org/project/fields/)