Efficient, Pythonic bidirectional map implementation and related functionality.

bidict logo


Latest release Documentation Build status Test coverage Supported Python implementations License Chat

Bidict is the standard bidirectional mapping library for Python.

Bidict is...

  • in use by several teams at Google, Bank of America Merrill Lynch, and many others,
  • has carefully designed APIs for safety, ergonomics, performance, and intuitiveness,
  • is CPython-, PyPy-, Python 2-, and Python 3-compatible,
  • has 100% test coverage, including property-based tests and benchmarks,
  • integrates with Python’s collections interfaces and abstract base classes,
  • is thoroughly and attentively documented, and
  • the code is mature, concise, and well-reviewed.

If you are thinking of using bidict in your work, or if you have any questions, comments, or suggestions, I’d love to know about your use case and provide as much support for it as possible.

Please feel free to leave a message in the chatroom or open an issue after reviewing the Contributors’ Guide. [1]

Release Notifications

Follow on VersionEye

Tip: Follow bidict on VersionEye to automatically be notified via email when a new version of bidict is released.


pip install bidict

Usage Documentation

For usage documentation, please start at the Introduction and proceed from there.


If you’re reading this on GitHub, PyPI, in your code editor, or in some other place that can’t render/link the full docs properly, you can find the bidict documentation on Read the Docs at:

Also note: multiple versions of the documentation are published on Read the Docs, and by default you will be taken to the version built from the master branch. You can choose different versions from the pop-up menu in the lower-right.

If you have the bidict source code handy, you can also browse the docs inside the docs directory, and build them yourself by running make html from within that directory (requires Sphinx).


Bidict is currently a one-person operation maintained on a voluntary basis for the public good. Your help would be most welcome.

If bidict has helped you accomplish your work, especially work you’ve been paid for, please consider supporting bidict’s maintenance and development.

Support bidict

For information about contributing to the code, please see the Contributors’ Guide. [1]


For a history of notable changes to bidict, check out the Changelog. [2]