Registry / serialization / named
library1.4.2pypypi✓ verified 84d ago

A Python library providing named types (newtypes) with runtime validation and type-checking support. Current version 1.4.2, requires Python ≥3.8, follows semantic versioning with regular releases.

pip install named
INSTALL
IMPORT
SIG · NAMED
N
named
serializationpythonv1.4.2
Install
17.4s avg
Import
45ms
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.2 · 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.048s · 18.1MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 17.4s · import 0.042s · 19MB
16MB installed
● package 16MB
Code
Verified usage

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

named
import named
Main package, all functions and classes are accessed from the top-level module.

Define a named type by subclassing `Named`. The subclass provides runtime type checking and can be used with type hints.

import named # Define a named type for UserId class UserId(named.Named): pass # Create an instance with validation uid = UserId(42) print(uid) # UserId(42) # Access the underlying value print(uid.value) # 42
Debug
Known issues
gotchaNamed types are immutable after creation: you cannot reassign the value attribute.
fix
Create a new instance with the desired value instead of modifying an existing one.
affects: all
gotchaThe `Named` class does not support custom `__init__` methods; initialization is handled by the parent class. Overriding `__init__` may break validation.
fix
Use class methods or properties to add custom behavior without overriding `__init__`.
affects: all
Errors
Common errors & fixes
ImportError: cannot import name 'Named' from 'named'
The correct import is `import named` then use `named.Named`; there is no direct `from named import Named`.
fix
Use `import named` and reference `named.Named`.
TypeError: 'Named' object does not support item assignment
Named objects are immutable and do not support setting attributes after creation.
fix
Create a new named instance instead of modifying existing one.
Upgrade
Version history
1.4.2latest on PyPI · released Mar 15, 2024
Audit
Dependencies

No dependency data recorded yet.

Agent activity
14 hits · last 30 days
node
12
Resources
named — pip install named · libregistry