{"id":21614,"library":"nocasedict","title":"nocasedict","description":"A case-insensitive ordered dictionary for Python. Version 2.2.0, supports Python >=3.9. Released under Apache 2.0. Maintained with irregular releases.","status":"active","version":"2.2.0","language":"python","source_language":"en","source_url":"https://github.com/pywbem/nocasedict","tags":["dict","case-insensitive","dictionary","ordered"],"install":[{"cmd":"pip install nocasedict","lang":"bash","label":"Default install"}],"dependencies":[],"imports":[{"note":"NocaseDict is a top-level class, not a module.","wrong":"import nocasedict.NocaseDict","symbol":"NocaseDict","correct":"from nocasedict import NocaseDict"}],"quickstart":{"code":"from nocasedict import NocaseDict\n\nd = NocaseDict({'KEY': 'value'})\nprint(d['key'])  # 'value'\nprint(d['KEY'])  # 'value'\nd['NewKey'] = 1\nprint('newkey' in d)  # True","lang":"python","description":"Create a case-insensitive dictionary and access keys case-insensitively."},"warnings":[{"fix":"Upgrade to 2.x only if using Python >=3.6. Code relying on __dict__ or internal key storage will break.","message":"Version 2.0.0 dropped support for Python 2.7 and 3.5. Also changes how keys are stored internally; no more separate lowercase key store. Bulk import may break if using internal attributes.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Use dict.fromkeys and convert: NocaseDict(dict.fromkeys(keys, value)).","message":"The 'NocaseDict.fromkeys' class method is deprecated since 2.2.0 and will be removed in a future release.","severity":"deprecated","affected_versions":"2.2.0 and later"},{"fix":"Be aware that case-insensitivity only applies within NocaseDict itself, not when comparing to dict.","message":"Equality comparison with regular dict is case-sensitive. NocaseDict('a':1) == {'a':1} is True, but NocaseDict('A':1) == {'a':1} is False.","severity":"gotcha","affected_versions":"all"},{"fix":"Ensure you override all relevant methods and call super().__setitem__ with the intended key.","message":"Inheritance from NocaseDict may cause unexpected behavior because it overrides __setitem__ and __getitem__ for case-insensitivity. Custom subclasses must carefully call super().","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":"Run: pip install nocasedict","cause":"Library not installed or installed in a different Python environment.","error":"ImportError: No module named 'nocasedict'"},{"fix":"Use: from nocasedict import NocaseDict","cause":"Incorrect import: trying to import from the module but the class is not found due to wrong import statement.","error":"AttributeError: module 'nocasedict' has no attribute 'NocaseDict'"},{"fix":"Create a new NocaseDict from the frozen one: NocaseDict(frozen_dict)","cause":"Accidentally passed a frozen instance or tried to use mappingproxy-like behavior.","error":"TypeError: 'NocaseDict' object does not support item assignment"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}