# jab/bidict

The bidirectional mapping library for Python.

Repository: https://github.com/jab/bidict
Canonical: https://ross.abutalabs.com/products/bidict
Homepage: https://bidict.readthedocs.io
Language: Python
License: MPL-2.0
License Family: copyleft
Topics: python, bidict, bimap, data-structures
Last push: 2026-08-25T23:51:41+00:00

## Health v2 (maintenance only)
Score: 99/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 99, release rhythm 99, longevity 100
- inputs: {"age_days": 4362, "days_push": 8, "days_rel": 8, "gap_med": 0, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1586, forks 69 (observed 2026-08-28T04:05:07.554291+00:00)

## What it is
bidict is a Python library providing efficient, type-hinted bidirectional mapping data structures where both keys and values can be looked up. It offers Pythonic dict-like APIs with an .inverse property, is dependency-free, and has been maintained since 2009.

## Use cases
- maintain a two-way lookup between ids and names in Python
- map enum values to labels and back
- invert a dictionary efficiently while keeping both directions in sync
- look up keys by value like a reverse dict
- store symbol-to-element and element-to-symbol mappings
- enforce one-to-one relationships between two sets of values

## When to choose
- you need both key->value and value->key lookups kept automatically in sync
- you want a mature, well-tested, zero-dependency Python library
- you need type-hinted, dict-like APIs with safety guarantees against duplicate values

## When to avoid
- you only need a one-time inversion of a dict (use {v: k for k, v in d.items()})
- your mappings are not one-to-one and you need multi-mapping semantics
- you are not working in Python

## Facets
- artifact type: library
- maturity: stable
- function: serialization
- domain: developer-tools
- platform: python, cross-platform
- tags: bidirectional-map, bimap, data-structures, dictionary, collections, algorithms

## Member repositories
- jab/bidict (main) score 99

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:07.554291+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:55:29.337951+00:00, confidence not recorded.
  - readme: https://github.com/jab/bidict (fetched 2026-08-28T04:05:07.554291+00:00, sha 3a002d0dab1e)
  - registry_pypi: https://pypi.org/pypi/bidict/json (fetched 2026-08-29T11:26:39.528065+00:00, sha 7dcc1efe6e1d)
- Data as of 2026-08-30T08:39:29.467469+00:00.
