{"id":3520,"library":"itypes","title":"itypes","description":"itypes is a Python library providing simple immutable container types and custom immutable objects. It prioritizes simplicity over performance, offering a way to create data structures that cannot be modified after creation. The current version is 1.2.0, released in April 2020, indicating a slow release cadence with limited recent development activity.","status":"maintenance","version":"1.2.0","language":"en","source_language":"en","source_url":"http://github.com/PavanTatikonda/itypes","tags":["immutable","types","data-structures","functional-programming"],"install":[{"cmd":"pip install itypes","lang":"bash","label":"Install with pip"}],"dependencies":[],"imports":[{"note":"For immutable dictionaries and lists.","symbol":"Configuration","correct":"from itypes import Configuration"},{"note":"For creating custom immutable objects.","symbol":"Object","correct":"from itypes import Object"}],"quickstart":{"code":"import itypes\n\n# Immutable dictionary-like object\nconfig = itypes.Configuration('worker-process', {'hostname': 'example.com', 'dynos': 4})\nprint(f\"Original config title: {config.title}\")\nprint(f\"Original config dynos: {config.get('dynos')}\")\n\n# Attempting to change an attribute directly will raise an error\ntry:\n    config.title = 'New Title'\nexcept TypeError as e:\n    print(f\"Caught expected error: {e}\")\n\n# To 'modify', a new object is returned\nnew_config = config.set('dynos', 2)\nprint(f\"New config dynos: {new_config.get('dynos')}\")\nprint(f\"Original config dynos (unchanged): {config.get('dynos')}\")\n\n# Custom immutable object\nclass Document(itypes.Object):\n    def __init__(self, title, content):\n        self._title = title\n        self._content = content\n\n    @property\n    def title(self):\n        return self._title\n\n    @property\n    def content(self):\n        return self._content\n\ndoc = Document(title='Immutability', content='For simplicity')\nprint(f\"Document title: {doc.title}\")\n\n# Attempting to change a public property directly will raise an error\ntry:\n    doc.title = 'Changed Title'\nexcept TypeError as e:\n    print(f\"Caught expected error on custom object: {e}\")","lang":"python","description":"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'."},"warnings":[{"fix":"Always 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.","message":"Attempting 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.","severity":"breaking","affected_versions":"All versions"},{"fix":"Evaluate 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.","message":"The library is explicitly \"designed for simplicity over performance\". If your application requires high-performance immutable data structures, the author suggests exploring alternatives like `pyrsistent`.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Test `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.","message":"The 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.","severity":"gotcha","affected_versions":"Future Python versions (beyond 3.8/3.9)"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}