bidict
The bidirectional mapping library for Python.
Decision gist · record as of 2026-08-14
Yes. bidict solves a real problem (maintaining two-way mappings) with a mature, zero-dependency implementation. It's widely used in production, actively maintained, has no known vulnerabilities, and integrates seamlessly into any Python project. The copyleft license is standard for libraries and poses no practical barrier for most use cases.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction: pure Python with no runtime dependencies outside the standard library, distributed as a wheel.
- Actively maintained since 2014 with recent commits.
License · maintenance · safety
MPL 2.0 (copyleft) — Copyleft license (MPL 2.0) requires derivative works to be distributed under the same license; acceptable for most internal use but imposes obligations if you modify and redistribute the code.
last release 2024-02-18 (908 days) · last repo commit 2026-07-20 · 1,584 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 29,879,393 downloads/mo, #808 on PyPI
Alternatives
Verify before relying
pip install bidict
from bidict import bidict
element_by_symbol = bidict({'H': 'hydrogen'})
print(element_by_symbol['H']) # 'hydrogen'
print(element_by_symbol.inverse['hydrogen']) # 'H'- Whether the inverse mapping is automatically kept in sync during concurrent modifications or if external synchronization is needed.
- Performance characteristics for very large bidicts (memory overhead, lookup speed scaling).
What it is and what it does
bidict is a Python library that implements a bidirectional dictionary—a data structure that maintains a consistent mapping in both directions simultaneously. When you create a bidict with key-value pairs, you can look up values by key (like a normal dict) and also access the inverse mapping to look up keys by value. The inverse is always kept in sync; modifying one direction automatically updates the other.
It's designed for scenarios where you need reliable two-way lookups without manually maintaining separate data structures. The library has no external runtime dependencies, is fully type-hinted, and has been in production use since 2009 by organizations including Google, Venmo, and CERN. It's actively maintained and covers all current Python versions.
Use it for
- Symbol-to-name mappings (e.g., element symbols to element names) where you need fast lookup in both directions.
- ID translation layers (e.g., internal IDs to external IDs) in APIs or database systems.
- Enum-like structures where you need to map codes to descriptions and descriptions back to codes.
- Configuration key aliasing where you want to support multiple names for the same setting.
- Language or encoding tables where you need to convert between two equivalent representations.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes.
bidict solves a real problem (maintaining two-way mappings) with a mature, zero-dependency implementation. It's widely used in production, actively maintained, has no known vulnerabilities, and integrates seamlessly into any Python project. The copyleft license is standard for libraries and poses no practical barrier for most use cases.
Install
bidict on PyPI
Before you install
Low friction: pure Python with no runtime dependencies outside the standard library, distributed as a wheel. Actively maintained since 2014 with recent commits.
License in practice
Copyleft license (MPL 2.0) requires derivative works to be distributed under the same license; acceptable for most internal use but imposes obligations if you modify and redistribute the code.
Quickstart
pip install bidict
from bidict import bidict
element_by_symbol = bidict({'H': 'hydrogen'})
print(element_by_symbol['H']) # 'hydrogen'
print(element_by_symbol.inverse['hydrogen']) # 'H'
Verify before relying
- Whether the inverse mapping is automatically kept in sync during concurrent modifications or if external synchronization is needed.
- Performance characteristics for very large bidicts (memory overhead, lookup speed scaling).
Package facts
| License | MPL 2.0 copyleft |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Actively maintained 908 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 29,879,393 / month, #808 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Operating System :: OS IndependentProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTyping :: Typed |
Evidence: bidict-0.23.1-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “bidirectional dictionary”
- bidictProvides a bidirectional dictionary (bidict) that maintains a…
- python-socketioPython implementation of Socket.IO realtime client and server for…
- collections-extendedProvides four specialized collection types—bag (multiset), setlist…
Give your agent the search over MCP, or paste the wish link into any chat.
Similar packages
A Sphinx extension that embeds OpenAPI specifications rendered with ReDoc directly into Sphinx documentation sites.
Sphinx extension that generates HTML redirect pages with meta refresh tags when you rename or move documentation files, preventing 404 errors without server-side configuration.
Converts bidirectional text (mixed left-to-right and right-to-left scripts) into display order for rendering, with both Python and Rust implementations available.
Install it if you need to display bidirectional text; the LGPL license is standard for text-processing libraries and poses no barrier for most projects.
Provides alternate keyring backend implementations for the keyring package, including plaintext and other non-standard credential storage methods.
Install only if you have a specific need for an alternate backend and accept responsibility for the security implications.
A Sphinx extension that defines documentation site-maps in a single YAML file using a top-down approach, instead of scattered toctree directives throughout source files.
Sphinx extension that renders OpenAPI (Swagger) specifications into formatted API documentation using the HTTP domain.
See also Pallets-Sphinx-Themes · transliterate · zict · breathe