{"id":20963,"library":"attmap","title":"attmap","description":"Multiple access patterns for key-value reference. attmap provides AttMap, a mapping subclass that allows attribute-style access (e.g., obj.key) alongside dict-style access (e.g., obj['key'] or obj.get('key')). It is useful for configuration objects, simple namespaces, and data structures where you want flexible key access. Version 0.14.0 is stable, requires Python >=3.8, and is maintained on GitHub (pepkit/attmap).","status":"active","version":"0.14.0","language":"python","source_language":"en","source_url":"https://github.com/pepkit/attmap","tags":["mapping","attribute-access","dict-subclass","configuration","key-value-store"],"install":[{"cmd":"pip install attmap","lang":"bash","label":"Install via pip"}],"dependencies":[{"reason":"Used for utility functions and type checking.","package":"ubelt","optional":false}],"imports":[{"note":"","wrong":"","symbol":"AttMap","correct":"from attmap import AttMap"}],"quickstart":{"code":"from attmap import AttMap\n\nconfig = AttMap()\nconfig.host = 'localhost'\nconfig['port'] = 8080\nprint(config.host)  # localhost\nprint(config['port'])  # 8080\nprint(config.get('nonexistent', 'default'))  # default","lang":"python","description":"Create an AttMap and use both attribute and dict-style access."},"warnings":[{"fix":"Use identical case for attribute access as the dict key.","message":"AttMap keys are case-sensitive; attribute access matches dict key exactly (including case).","severity":"gotcha","affected_versions":"all"},{"fix":"Avoid keys that are not valid identifiers if you need attribute access, or use obj['key'].","message":"Keys must be valid Python identifiers for attribute access. Keys that are not valid identifiers (e.g., containing spaces or starting with a digit) can only be accessed via dict-style subscript or get().","severity":"gotcha","affected_versions":"all"},{"fix":"Access such keys via dict-style subscript: obj['keys'].","message":"Inherited attributes from dict (e.g., keys(), items(), etc.) may shadow stored keys. If you store a key with the same name as a dict method, the dict method takes precedence when accessed as an attribute.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'AttMap' instead of any deprecated aliases.","message":"The 'AttMap' class is the recommended name; older aliases like 'AttrDict' may be removed in future versions.","severity":"deprecated","affected_versions":"<0.14.0"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Check that the key exists and is a valid Python identifier; if not, use obj['key'] instead.","cause":"The key does not exist or is only accessible via dict-style access because the key string is not a valid identifier.","error":"AttributeError: 'AttMap' object has no attribute 'key'"},{"fix":"Use .get('key', default) to avoid the error, or ensure the key exists before access.","cause":"The key does not exist in the AttMap.","error":"KeyError: 'key'"},{"fix":"Check if you are using a read-only variant; use the standard AttMap for mutable operations.","cause":"Trying to assign to a frozen or read-only AttMap instance (if such variant is used).","error":"TypeError: 'AttMap' object does not support item assignment"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}