skillfed

recordtype

Similar to namedtuple, but instances are mutable.

recordtype v1.4 93.0K downloads/30d#13,407 on PyPI
Permissive license Apache License Version 2.0 Abandoned released

What it is and what it does

recordtype is a factory function that generates mutable record classes—similar to collections.namedtuple but with write support and flexible default-value handling. Unlike namedtuple, instances are fully mutable, and you can specify per-field defaults, a global default for all unspecified fields, or both. It depends only on six and generates pure Python classes with introspection members like _fields, _asdict(), and _source.

The package is production-stable but abandoned; its author explicitly recommends that Python 3.7+ users use dataclasses instead, and points to namedlist and attrs as better-maintained alternatives. It remains useful for legacy codebases or Python 2 compatibility, but new projects should consider those alternatives.

Use it for:

  • Migrating from namedtuple to a mutable variant when you need to modify field values after instantiation.
  • Creating lightweight data containers with sensible field defaults to reduce boilerplate initialization code.
  • Supporting Python 2.6+ codebases that predate dataclasses and need a simple mutable record type.
  • Building configuration or state objects where fields have meaningful defaults and occasional mutation is expected.

Worth the install?

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

recordtype creates mutable record classes with optional per-field and global default values, similar to namedtuple but with write support and configurable defaults.

No, unless you are maintaining legacy Python 2 code or a codebase already using recordtype. For new projects on Python 3.7+, use dataclasses; for more advanced use cases, use attrs or namedlist. The package is abandoned and its author recommends against it.

Install

recordtype on PyPI

pip

pip install recordtype

uv

uv add recordtype

poetry

poetry add recordtype

Installing recordtype

Before you install

Low install friction with a single pure-Python dependency (six). However, the package is abandoned as of 1422 days since its last release; the author explicitly recommends Python 3.7+ users switch to dataclasses, and points to namedlist and attrs as better-maintained alternatives.

License in practice

Licensed under Apache License Version 2.0 (permissive). You can use, modify, and distribute recordtype freely in commercial and private projects with minimal restrictions.

Quickstart

from recordtype import recordtype

Point = recordtype('Point', [('x', 0), ('y', 0)])
p = Point()
p.x = 5
print(p.x, p.y)  # 5 0

Verify before relying

  • Whether the package works reliably on Python 3.10+ despite the last update being in 2022.
  • Performance characteristics compared to dataclasses or attrs in modern Python versions.
  • Whether the mutable-default-value warning mentioned in the changelog is still active.

Package facts

License Apache License Version 2.0 (permissive)
Python support not specified
Install friction low — pure-Python wheel
Runtime dependencies 1 — six
Maintenance abandoned — 1,422 days since the last release
First released
Downloads 93,010/month — #13,407 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: recordtype-1.4-py2.py3-none-any.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software Development :: Libraries :: Python Modules

Tags

mutable namedtuplerecord type with defaultsmutable data structurefield defaults factorynamedtuple alternativewritable tuple-like classstructured data with mutations
legacydata-structure

More Python Modules packages