skillfed

bidict

The bidirectional mapping library for Python.

bidict Copyleft license MPL 2.0 Active 1,584 v0.23.1 released

Install

bidict on PyPI

pip

pip install bidict

uv

uv add bidict

poetry

poetry add bidict

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 — 907 days since the last release
Last repo commit
First released
Popularity one of the top 1,000 most-downloaded packages on PyPI (30-day window, as of 2026-08-13)
Known vulnerabilities none known (OSV.dev, checked 2026-08-13)

Evidence: bidict-0.23.1-py3-none-any.whl

Keywords: bidict, bimap, bidirectional, dict, dictionary, mapping, collections

License :: OSI Approved :: Mozilla Public License 2.0 (MPL 2.0)Operating System :: OS IndependentProgramming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTyping :: Typed

About bidict

from the package's own PyPI description — quoted content, verbatim

.. role:: doc .. (Forward declaration for the "doc" role that Sphinx defines for interop with renderers that are often used to show this doc and that are unaware of Sphinx (GitHub.com, PyPI.org, etc.). Use :doc: rather than :ref: here for better interop as well.)

bidict

The bidirectional mapping library for Python.

Status

.. image:: https://img.shields.io/pypi/v/bidict.svg :target: https://pypi.org/project/bidict :alt: Latest release

.. image:: https://img.shields.io/readthedocs/bidict/main.svg :target: https://bidict.readthedocs.io/en/main/ :alt: Documentation

.. image:: https://github.com/jab/bidict/actions/workflows/test.yml/badge.svg :target: https://github.com/jab/bidict/actions/workflows/test.yml?query=branch%3Amain :alt: GitHub Actions CI status

.. image:: https://img.shields.io/pypi/l/bidict.svg :target: https://raw.githubusercontent.com/jab/bidict/main/LICENSE :alt: License

.. image:: https://static.pepy.tech/badge/bidict :target: https://pepy.tech/project/bidict :alt: PyPI Downloads

.. image:: https://img.shields.io/badge/GitHub-sponsor-ff69b4 :target: https://github.com/sponsors/jab :alt:...

Read as markdown · JSON record · Source repository · Docs

AI interpretation — verify before relying

AI-generated interpretation of the package facts above; every digit, version, license, or vulnerability id it cites is grounded in the facts already shown on this page

bidict provides a bidirectional dictionary data structure that maintains consistent forward and inverse mappings, allowing you to look up keys by values and values by keys with equal efficiency.

Installation is straightforward with no runtime dependencies outside Python's standard library. The package is actively maintained with a last commit on 2026-07-20 and has been in continuous development since 2014.

bidict is licensed under MPL 2.0, a copyleft license. Users must comply with MPL 2.0 terms when distributing bidict or derivative works, including providing source code and documenting modifications.

Usage

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'

Requires Python 3.8 or later.

Verdict: bidict is a mature, well-maintained library (active since 2009, top 1000 PyPI packages) with zero known vulnerabilities, no external dependencies, and full type hints. The MPL 2.0 copyleft license requires compliance with source-code and modification-disclosure terms. Suitable for production use where bidirectional mapping is needed.

Needs verification

  • Whether the 907 days since last release (2024-02-18) reflects a stable mature project or potential maintenance lag relative to Python ecosystem evolution.
  • Whether MPL 2.0's copyleft scope (file-level vs. project-level) affects your specific distribution model.
bidirectional dictionary pythonbimap two-way mappingreverse lookup dictbidirectional mapping librarykey value inverse lookupsymmetric dictionary

Similar packages