jab

bidict: Bidirectional Mappings for Python

bidict is a lightweight Python library for mappings that can be looked up from either keys or values. Its inverse view makes one-to-one relationships convenient to query while helping keep both sides consistent.

Stars
1.6k
Forks
70
Stars, last 30 days
+3
Last commit
13 days ago
Contributors
19

Our take

Activeregular commits and releases

Health score

59/100

How it is scored
Activity
67
Community
33
Issues
67
Pull requests
70

+3 stars in the last 30 days

bidict is a focused, mature Python utility with active releases, though its maintenance is highly concentrated in one contributor.

Good fit if

  • Your Python code needs to query one-to-one mappings in both directions.
  • You want a standard-library-only runtime dependency profile and use Python 3.11 or later.
  • You are comfortable adopting an MPL-2.0-licensed library with a long history and recent releases.

Look elsewhere if

  • Your data does not have unique values, so a one-to-one inverse mapping does not fit.
  • Your project must support Python versions older than 3.11.
  • Your organization requires maintenance to be distributed across several highly active contributors.
All health signals
Last commit2026-10-04 (13 days ago)
Commits, last 90 days100+
Releases, last 12 months2 (latest v0.24.1, 2026-08-25)
Contributors19 (top contributor: 94% of commits)
Issues closed, last 90 days4 (typically closed in 1 day)
Pull requests merged, last 90 days32 (typically merged in 0 days)
Project age12 years

Checked on 2026-10-18 with the GitHub API.

Project history

Daily GitHub snapshots since Oct 7, 2026. History covers stars and forks; health signals are not tracked historically.

Selected snapshot

Stars

1,590

Forks

73

Change since Nov 16, 2026: 0 stars·0 forks

Overview

bidict is a bidirectional mapping library for Python, built on Python's standard library with no runtime dependencies beyond it. It addresses a common need in applications that represent one-to-one relationships: look up a value from its key, or use the inverse mapping to find the key from a value.

The familiar mapping interface makes bidict suitable for Python code that needs both directions without maintaining two separate dictionaries itself. The project targets Python 3.11 and later, and its documentation covers usage and implementation details.

Key Features

  • Look up values through the standard mapping interface, such as mapping[key].
  • Access the inverse mapping with mapping.inverse to look up keys from values.
  • Provide familiar, Pythonic APIs designed for safety and flexibility.
  • Run without runtime dependencies outside Python's standard library.
  • Include type hints and documentation for users and contributors.
  • Test across supported Python versions, including property-based tests, according to the README.

Use Cases

  • A Python application can map element symbols to names and retrieve symbols from names through the inverse view.
  • A service can represent unique identifiers and their corresponding records when lookups are needed in both directions.
  • A developer can replace paired dictionaries for a one-to-one relationship with one mapping that exposes both directions.
  • A library author can use a typed, documented bidirectional mapping rather than implementing inverse lookup and consistency handling from scratch.

What you need

Detected in the repository

  • Python >=3.11 (from pyproject.toml)
  • A test suite and automated checks on GitHub Actions

License in plain words

MPL-2.0weak copyleft

  • Commercial use: yes
  • Modify and redistribute: yes
  • You must keep: the license notice
  • Share your changes: yes, changes to MPL-licensed files, when you distribute them
  • Includes an explicit patent grant from the contributors:

A summary, not legal advice: the LICENSE file is what applies.

Getting Started

Install the package with:

pip install bidict

See the README and documentation for usage details.

Considerations

The repository is active, with regular commits and releases, but most contributions come from one person. Teams adopting it should account for that contributor concentration when planning long-term maintenance. The declared runtime requirement is Python 3.11 or later. The project uses the MPL-2.0 license, so review its terms for your distribution and compliance needs.

Found this useful?

Share it with someone who would like bidict.