bidict: The Bidirectional Mapping Library for Python
This repository profile is provided by osrepos.com, an open source repository discovery platform.

Summary
bidict is a mature and lightweight Python library designed for creating bidirectional mappings. It provides familiar, Pythonic APIs for safe, simple, and flexible data handling, making it a reliable choice for projects requiring efficient two-way lookups. Trusted by major organizations since 2009, bidict ensures robust and well-tested functionality.
Repository Information
Topics
Click on any tag to explore related repositories
Use at your own risk
OSRepos shares public repositories for knowledge and discovery only. Any installation, execution, configuration, or use of code from these repositories is the user's own responsibility. Always review the repository, source code, dependencies, licenses, and security implications before running or installing anything. OSRepos is not responsible for issues, damages, or losses resulting from third-party repositories.
Introduction
bidict is a robust Python library that provides bidirectional mapping capabilities, allowing you to easily look up values by keys and keys by values. Since its inception in 2009, it has been a trusted solution, relied upon by major organizations like Google, Venmo, CERN, Baidu, and Tencent for their data structure needs.
Installation
To get started with bidict, simply install it using pip:
pip install bidictExamples
Here's a quick example to demonstrate bidict's core functionality:
from bidict import bidict
element_by_symbol = bidict({'H': 'hydrogen'})
print(element_by_symbol['H'])
print(element_by_symbol.inverse['hydrogen'])Why Use bidict?
bidict stands out for several reasons:
- Mature and Trusted: With over a decade of development, it's a proven solution used by leading companies.
- Pythonic APIs: Designed for safety, simplicity, flexibility, and ergonomics, making it intuitive for Python developers.
- Lightweight: It has no runtime dependencies beyond Python's standard library.
- High Quality Code: Implemented in concise, fully type-hinted Python, optimized for efficiency and long-term stability.
- Extensive Documentation: Comprehensive documentation is available to help you get the most out of the library.
- 100% Test Coverage: Ensures reliability across all supported Python versions, including property-based tests and benchmarks.
Links
For more information, documentation, and to contribute, check out these official links:
Source repository
Open the original repository on GitHub.
15 counted GitHub visits