Registry / serialization / recordtype

recordtype

JSON →
library1.4pypypi✓ verified 86d ago

Provides a mutable alternative to namedtuple. Users define a class with fields and get a mutable, tuple-like object with named attributes. Last stable version is 1.4, released in 2012. No active development, but still usable. Use with caution in new projects.

pip install recordtype
INSTALL
IMPORT
SIG · RECORDTYPE
R
recordtype
serializationpythonv1.4
Install
1.6s avg
Import
12ms
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v1.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.012s · 17.9MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.6s · import 0.010s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

recordtype
from recordtype import recordtype
import recordtype
Direct import recordtype is not a class; it's a module. Must import the class.

Creates a mutable record type with named fields.

from recordtype import recordtype # Define a record type Person = recordtype('Person', 'name age email') p = Person('Alice', 30, 'alice@example.com') print(p.name) # Alice p.age = 31 # mutable print(p.age) # 31
Debug
Known issues
deprecatedrecordtype has been unmaintained since 2012. Consider using types.SimpleNamespace, dataclasses, or attrs for new projects.
fix
Use from dataclasses import dataclass and define a class with fields.
affects: all
gotchaField names are specified as a single string with spaces. It's easy to accidentally use commas or other delimiters.
fix
Always use a space-separated string: recordtype('Name', 'field1 field2 field3').
affects: all
gotcharecordtype does not support type hints or validation. Field values can be any type and are not checked.
fix
Consider using dataclasses with type annotations if you need type safety.
affects: all
breakingrecordtype returns an object that is not compatible with some pickle protocols due to its internal _fields attribute.
fix
If you need pickle, implement __reduce__ manually or switch to a different library.
affects: all
Errors
Common errors & fixes
AttributeError: module 'recordtype' has no attribute 'recordtype'
Importing recordtype incorrectly: import recordtype instead of from recordtype import recordtype.
fix
Use: from recordtype import recordtype
TypeError: __new__() missing 1 required positional argument: '...'
Providing field names as a list or tuple instead of a single space-separated string.
fix
Pass field names as a string: recordtype('Person', 'name age')
TypeError: cannot unpack non-iterable Person object
recordtype does not support tuple unpacking because it is not a tuple subclass.
fix
Access fields by name, not by unpacking. If unpacking is needed, consider namedtuple or dataclasses.
Upgrade
Version history
1.4latest on PyPI · released Sep 22, 2022
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
recordtype — pip install recordtype · libregistry