recordclass
Mutable variant of namedtuple -- recordclass, which support assignments, compact dataclasses and other memory saving variants.
Decision gist · record as of 2026-08-14
Yes, if you are building memory-sensitive applications with many small objects and can guarantee no circular references. The active maintenance, permissive license, and support for modern Python versions (3.8–3.14) make it reliable. However, the high install friction (source compilation required) and narrow use case (only beneficial when memory overhead of PyGC_Head is a real bottleneck) mean it is not a general-purpose replacement for dataclass or namedtuple—install only when profiling shows memory is a constraint.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires a C compiler and Python development headers to build from source; pre-built wheels may not be available for all platforms.
- Installation requires compilation from source (high friction).
- The package is actively maintained with recent commits and supports modern Python versions (3.8–3.14), but the build dependency may complicate deployment in restricted environments.
License · maintenance · safety
permissive license (permissive) — MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
last release 2026-01-05 (221 days) · last repo commit 2026-07-20 · 37 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 126,365 downloads/mo, #11,778 on PyPI
Alternatives
Verify before relying
from recordclass import recordclass, dataobject, astuple, asdict
# Factory function
Point = recordclass('Point', 'x y')
p = Point(1, 2)
p.y = -1
print(astuple(p)) # (1, -1)
print(asdict(p)) # {'x': 1, 'y': -1}
# Class-based
class Coord(dataobject):
x: int
y: int
c = Coord(3, 4)
print(c.x, c.y)- Whether pre-built wheels are available for common platforms or if source compilation is always required.
- Actual memory savings in real-world applications compared to dataclass or __slots__ with typical field counts.
- Whether the reference-cycle avoidance guarantee holds under all documented use patterns.
What it is and what it does
Recordclass is a library for creating lightweight, mutable record types in Python that avoid the memory overhead of standard dataclasses and namedtuples by opting out of cyclic garbage collection. It provides three main interfaces: a `recordclass` factory (namedtuple-like), a `dataobject` base class (dataclass-like), and lightweight container types (`litetuple`, `mutabletuple`) designed for scenarios where you are certain your objects will never participate in reference cycles.
The library is built on a custom metaclass that skips the `PyGC_Head` prefix normally added to Python objects, reducing per-instance memory by 16–32 bytes depending on Python version. This is most useful for applications that create many small, short-lived objects with simple field types (int, float, str, date/time), such as coordinate records, scientific data points, or compact data structures in memory-constrained environments. The trade-off is that you must manually ensure no circular references are created; the library does not enforce this at runtime.
Use it for
- Store millions of coordinate or vector records (x, y, z) in memory-intensive scientific or graphics applications.
- Build compact data structures for machine learning feature vectors where memory footprint directly impacts cache performance.
- Replace namedtuple in high-throughput data pipelines where object creation speed and size matter.
- Create immutable or mutable tuple-like containers (litetuple, mutabletuple) for collections that will never form cycles.
- Define strongly-typed record classes with type hints that consume less memory than standard dataclass instances.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you are building memory-sensitive applications with many small objects and can guarantee no circular references.
The active maintenance, permissive license, and support for modern Python versions (3.8–3.14) make it reliable. However, the high install friction (source compilation required) and narrow use case (only beneficial when memory overhead of PyGC_Head is a real bottleneck) mean it is not a general-purpose replacement for dataclass or namedtuple—install only when profiling shows memory is a constraint.
Install
recordclass on PyPI
Before you install
Installation requires compilation from source (high friction). The package is actively maintained with recent commits and supports modern Python versions (3.8–3.14), but the build dependency may complicate deployment in restricted environments.
Requires a C compiler and Python development headers to build from source; pre-built wheels may not be available for all platforms.
License in practice
MIT License permits unrestricted use, modification, and distribution with minimal restrictions—suitable for both open-source and proprietary projects.
Quickstart
from recordclass import recordclass, dataobject, astuple, asdict
# Factory function
Point = recordclass('Point', 'x y')
p = Point(1, 2)
p.y = -1
print(astuple(p)) # (1, -1)
print(asdict(p)) # {'x': 1, 'y': -1}
# Class-based
class Coord(dataobject):
x: int
y: int
c = Coord(3, 4)
print(c.x, c.y)
Verify before relying
- Whether pre-built wheels are available for common platforms or if source compilation is always required.
- Actual memory savings in real-world applications compared to dataclass or __slots__ with typical field counts.
- Whether the reference-cycle avoidance guarantee holds under all documented use patterns.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | High. Source build required |
| Runtime dependencies | None |
| Maintenance | Actively maintained 221 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 126,365 / month, #11,778 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 4 - BetaIntended Audience :: DevelopersIntended Audience :: Science/ResearchLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: CythonProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules |
Evidence: recordclass-0.24.tar.gz
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “memory-efficient dataclass”
- recordclassRecordclass provides memory-efficient, mutable alternatives to…
- dataclass-wizardDataclass Wizard converts Python dataclasses to and from JSON, YAML,…
- dataclass-factoryConverts dataclasses to and from dictionaries and other common types…
Give your agent the search over MCP, or paste the wish link into any chat.
More Python Modules packages
Converts domain names between Unicode and ASCII-compatible encoding (Punycode) according to IDNA 2008 and Unicode Technical Standard 46, with security validation and broader script coverage than the standard library.
Install it if you work with internationalized domain names, need to validate domains, or use HTTP clients that depend on it transitively.
Setuptools is a Python build backend and package management tool that handles building, distributing, and installing Python packages, including support for C/C++ extension modules.
PyYAML parses and emits YAML 1.1 data format, enabling serialization and deserialization of configuration files and Python objects to and from human-readable YAML text.
Pydantic validates Python data structures against type hints, coercing and checking input at runtime to ensure it matches a declared schema.
Provides reusable metadata objects for use with PEP-593 `typing.Annotated` to express common constraints like bounds, collection sizes, and predicates on types.
Install it if you use or build libraries that need to express type constraints in a standardized, inspectable way—or if you want to annotate your own types with…
Provides runtime tools to inspect and introspect Python type annotations, enabling programmatic examination of type hints at execution time.
See also namedlist · recordtype · dataclass-csv · tinsel · dataclass-factory · HeapDict · ordered-set · itemadapter · fields · dataclasses