nocasedict
A case-insensitive list for Python
What it is and what it does
NocaseDict is an ordered dictionary implementation that performs case-insensitive key lookups while preserving the original lexical case of keys as they were inserted. When you access a key, the lookup is case-insensitive (so 'ALPHA', 'alpha', and 'Alpha' all retrieve the same value), but when you print or iterate the dictionary, keys appear in their original form.
The package implements the full Python 3.14 dict API on all supported Python versions (3.9+), with customizable casefolding behavior via str.casefold() for unicode strings and bytes.lower() for byte strings by default. It also provides mixin classes for adding hashability and attribute-based key access, making it suitable for scenarios where case-insensitive matching is needed without sacrificing the ability to preserve the original key format.
Use it for:
- HTTP header handling where header names are case-insensitive but original casing should be preserved in responses
- Configuration file parsing where option names are matched case-insensitively but displayed in their original form
- API parameter matching where user input may vary in case but should map to canonical keys
- Database column name lookups where case-insensitive matching is needed but original column names must be retained
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
A case-insensitive ordered dictionary that preserves the original lexical case of its keys, supporting the full dict API with customizable casefolding.
Yes, if you need case-insensitive dictionary semantics with key-case preservation. The package is actively maintained, production-stable, has low install friction, and covers a genuine use case not well-served by existing alternatives. The LGPL-2.1-or-later license requires attention in proprietary projects but poses no barrier for open-source work.
Install
nocasedict on PyPI
pip
pip install nocasedictuv
uv add nocasedictpoetry
poetry add nocasedictInstalling nocasedict
Before you install
Low install friction with a single runtime dependency (typing-extensions). Actively maintained with recent commits and production-stable status across modern Python versions.
License in practice
Licensed under LGPL-2.1-or-later (copyleft). Derivative works and modifications must be released under compatible terms; suitable for open-source projects but requires care in proprietary contexts.
Quickstart
pip install nocasedict
from nocasedict import NocaseDict
dict1 = NocaseDict({'Alpha': 1, 'Beta': 2})
print(dict1['ALPHA']) # Returns 1
print(dict1) # Prints NocaseDict({'Alpha': 1, 'Beta': 2})
Verify before relying
- Performance characteristics compared to standard dict for large datasets
- Behavior when keys differ only in case (e.g., 'Alpha' vs 'ALPHA' as separate inserts)
Package facts
| License | LGPL-2.1-or-later (copyleft) |
| Python support | supports the current Python release (>=3.9) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — typing-extensions |
| Maintenance | actively maintained — 222 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 107,769/month — #12,598 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: nocasedict-2.2.0-py3-none-any.whl
Keywords: list, case-insensitive
Tags
More Python Modules packages
Converts domain names between Unicode and…
permissive · top 100 on PyPI
setuptoolsSetuptools is a Python build backend and…
permissive · top 100 on PyPI
PyYAMLPyYAML parses and emits YAML 1.1 data format,…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
annotated-typesProvides reusable metadata objects for use with…
permissive · top 100 on PyPI
typing-inspectionProvides runtime tools to inspect and…
permissive · top 100 on PyPI
multidictMultidict is a dict-like container that allows…
permissive · top 100 on PyPI
orderedmultidictorderedmultidict provides a dictionary that…
permissive · top 5,000 on PyPI
ordereddictProvides an OrderedDict implementation for…
permissive · top 15,000 on PyPI
lexidGenerates lexically ordered numerical IDs that…
permissive · top 15,000 on PyPI
ordered-setOrderedSet is a mutable collection that…
permissive · top 1,000 on PyPI
sort-linesAlphabetizes lines in files based on…
permissive · top 15,000 on PyPI
regexA drop-in replacement for Python's standard…
permissive · top 100 on PyPI
jaraco.collectionsProvides specialized collection classes that…
permissive · top 5,000 on PyPI
expiringdictExpiringDict is an ordered dictionary that…
permissive · top 5,000 on PyPI
sortedcollectionsProvides specialized sorted collection data…
permissive · top 15,000 on PyPI