Skip to main content

nocasedict - A case-insensitive ordered dictionary for Python

Version on Pypi Test status (master) Docs status (master) Test coverage (master)

Overview

Class NocaseDict is a case-insensitive ordered dictionary that preserves the original lexical case of its keys.

Example:

$ python
>>> from nocasedict import NocaseDict

>>> dict1 = NocaseDict({'Alpha': 1, 'Beta': 2})

>>> dict1['ALPHA']  # Lookup by key is case-insensitive
1

>>> print(dict1)  # Keys are returned with the original lexical case
NocaseDict({'Alpha': 1, 'Beta': 2})

The NocaseDict class supports the functionality of the built-in dict class of Python 3.14 on all Python versions it supports (except for being case-insensitive, of course).

The case-insensitivity is achieved by matching any key values as their casefolded values. By default, the casefolding is performed with str.casefold() for unicode string keys and with bytes.lower() for byte string keys. The default casefolding can be overridden with a user-defined casefold method.

Functionality can be added using mixin classes:

  • HashableMixin mixin class: Adds case-insensitive hashability.
  • KeyableByMixin mixin generator function: Adds ability to get the key from an attribute of the value object.

Why yet another case-insensitive dictionary: We found that all previously existing case-insensitive dictionary packages on Pypi either had flaws, were not well maintained, or did not support the Python versions we needed.

Installation

To install the latest released version of the nocasedict package into your active Python environment:

$ pip install nocasedict

This will also install any prerequisite Python packages.

For more details and alternative ways to install, see Installation.

Documentation

Change History

Contributing

For information on how to contribute to the nocasedict project, see Contributing.

License

The nocasedict project is provided under the GNU Lesser General Public License (LGPL) version 2.1, or (at your option) any later version.

Release files for nocasedict 2.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for nocasedict 2.2.1
File Size Uploaded
nocasedict-2.2.1.tar.gz 135.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for nocasedict 2.2.1
File Interpreter ABI Platform
nocasedict-2.2.1-py3-none-any.whl Python 3 none any Details

Total release size: 157.7 kB

Release files / nocasedict-2.2.1.tar.gz

Download URL nocasedict-2.2.1.tar.gz
Size 135.1 kB
Tags Source
SHA-256 checksum
How to use checksums
ebe159ca847304949120650aabef6698ff26c4528c55760487759283632ce7e8
BLAKE2b-256 checksum
How to use checksums
d39a653c3c7d1b1d1917f65d668b90ad43787dbb60c880c438dfcaf704ff9920
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release files / nocasedict-2.2.1-py3-none-any.whl

Download URL nocasedict-2.2.1-py3-none-any.whl
Size 22.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e82902c1416b791676625ed022139fc95e34a3c9f228b48f5185a9b4d4cad33c
BLAKE2b-256 checksum
How to use checksums
ccb1808050fa49b6d83bc3bc5dd0d42dc5fa9307c5e84d7ccaf5eb69319dfbb7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 31, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

2.2.1 This release

2 release files

2.2.0

2 release files

2.1.0

2 release files

2.0.5

2 release files

2.0.4

2 release files

2.0.3

2 release files

2.0.2

2 release files

2.0.1

2 release files

2.0.0

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.4

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.5.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page