{"id":21603,"library":"named","title":"named","description":"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.","status":"active","version":"1.4.2","language":"python","source_language":"en","source_url":"https://github.com/nekitdev/named","tags":["types","newtype","validation","python","type-hints"],"install":[{"cmd":"pip install named","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Main package, all functions and classes are accessed from the top-level module.","wrong":null,"symbol":"named","correct":"import named"}],"quickstart":{"code":"import named\n\n# Define a named type for UserId\nclass UserId(named.Named):\n    pass\n\n# Create an instance with validation\nuid = UserId(42)\nprint(uid)  # UserId(42)\n\n# Access the underlying value\nprint(uid.value)  # 42","lang":"python","description":"Define a named type by subclassing `Named`. The subclass provides runtime type checking and can be used with type hints."},"warnings":[{"fix":"Create a new instance with the desired value instead of modifying an existing one.","message":"Named types are immutable after creation: you cannot reassign the value attribute.","severity":"gotcha","affected_versions":"all"},{"fix":"Use class methods or properties to add custom behavior without overriding `__init__`.","message":"The `Named` class does not support custom `__init__` methods; initialization is handled by the parent class. Overriding `__init__` may break validation.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Use `import named` and reference `named.Named`.","cause":"The correct import is `import named` then use `named.Named`; there is no direct `from named import Named`.","error":"ImportError: cannot import name 'Named' from 'named'"},{"fix":"Create a new named instance instead of modifying existing one.","cause":"Named objects are immutable and do not support setting attributes after creation.","error":"TypeError: 'Named' object does not support item assignment"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}