Install & Compatibility
Where this runs
tested against v1.2.0 · 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
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
Dict
✓ from itypes import Dict
✗ from itypes import Configuration
List
✓ from itypes import List
Object
✓ from itypes import Object
Demonstrates how to create and interact with immutable Configuration objects and custom immutable objects by subclassing itypes.Object. Highlights that direct modification is prevented, requiring new objects for 'changes'.
import itypes
# Immutable dictionary-like object
config = itypes.Configuration('worker-process', {'hostname': 'example.com', 'dynos': 4})
print(f"Original config title: {config.title}")
print(f"Original config dynos: {config.get('dynos')}")
# Attempting to change an attribute directly will raise an error
try:
config.title = 'New Title'
except TypeError as e:
print(f"Caught expected error: {e}")
# To 'modify', a new object is returned
new_config = config.set('dynos', 2)
print(f"New config dynos: {new_config.get('dynos')}")
print(f"Original config dynos (unchanged): {config.get('dynos')}")
# Custom immutable object
class Document(itypes.Object):
def __init__(self, title, content):
self._title = title
self._content = content
@property
def title(self):
return self._title
@property
def content(self):
return self._content
doc = Document(title='Immutability', content='For simplicity')
print(f"Document title: {doc.title}")
# Attempting to change a public property directly will raise an error
try:
doc.title = 'Changed Title'
except TypeError as e:
print(f"Caught expected error on custom object: {e}")
Debug
Known issues
breakingAttempting to modify attributes of `itypes` objects directly (e.g., `obj.attribute = value`) will raise a `TypeError` because they are designed to be immutable. Instead, use methods provided by the object (like `.set()` for `Configuration`) which return a new object with the desired changes.fixAlways treat `itypes` objects as immutable. To produce a 'modified' state, call the appropriate method (e.g., `new_obj = old_obj.set('key', 'value')`) that returns a new instance. affects: All versions
gotchaThe library is explicitly "designed for simplicity over performance". If your application requires high-performance immutable data structures, the author suggests exploring alternatives like `pyrsistent`.fixEvaluate your performance requirements. For performance-critical applications, consider `pyrsistent` or other optimized immutable data structure libraries. For simple use cases where code clarity and immutability guarantees are paramount, `itypes` remains suitable.
affects: All versions
gotchaThe project shows limited recent development activity. The last release (1.2.0) was in April 2020, and the last code push on GitHub was approximately 7 years ago (as of 2026). This may imply a lack of support for newer Python versions or delayed bug fixes.fixTest `itypes` thoroughly with your target Python version. Be prepared to fork the repository or migrate to a more actively maintained library if compatibility or critical bug fixes become necessary.
affects: Future Python versions (beyond 3.8/3.9)
Upgrade
Version history
1.2.0latest on PyPI · released Apr 19, 2020
Audit
Dependencies
No dependency data recorded yet.