skillfed

nocasedict

A case-insensitive list for Python

nocasedict v2.2.0 107.8K downloads/30d#12,598 on PyPI4
Copyleft license LGPL-2.1-or-later Active released

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 nocasedict

uv

uv add nocasedict

poetry

poetry add nocasedict

Installing 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

Development Status :: 5 - Production/StableIntended Audience :: DevelopersOperating System :: OS IndependentProgramming Language :: Python :: 3Programming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Topic :: Software Development :: Libraries :: Python Modules

Tags

case-insensitive dictionarycase-insensitive dict pythonordered dict case-insensitivecasefold dictionarycase-insensitive key lookup
case-insensitivedata-structure

More Python Modules packages