skillfed

pymongocrypt

Python bindings for libmongocrypt

pymongocrypt v1.18.1 1.3M downloads/30d#4,112 on PyPI109
Permissive license Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) Active released

What it is and what it does

PyMongoCrypt is a Python wrapper around libmongocrypt that implements client-side field-level encryption (CSFLE) for MongoDB. It uses cffi to bind to the native libmongocrypt library and cryptography for cryptographic operations, allowing developers to encrypt sensitive data on the client before sending it to MongoDB.

The package is designed to integrate with MongoDB drivers to provide transparent encryption at the field level. It ships pre-built wheels for macOS, Windows, and manylinux platforms that include an embedded libmongocrypt build, reducing setup friction. For source installations or older pip versions, you must manually install libmongocrypt and point PyMongoCrypt to it via the PYMONGOCRYPT_LIB environment variable. The package supports modern Python versions and is actively maintained by MongoDB.

Use it for:

  • Encrypt sensitive fields in MongoDB documents before transmission to comply with data protection regulations.
  • Implement field-level encryption in MongoDB driver applications without modifying application-level encryption logic.
  • Integrate client-side encryption into PyMongo or other MongoDB drivers for automatic field encryption/decryption.
  • Protect personally identifiable information (PII) or financial data stored in MongoDB with transparent client-side encryption.
  • Build multi-tenant applications where each tenant's data is encrypted with tenant-specific keys.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

PyMongoCrypt provides Python bindings for libmongocrypt, enabling client-side encryption for MongoDB drivers through cffi and cryptography.

Yes, if you need client-side encryption for MongoDB. The package is production-stable, actively maintained, and has no known vulnerabilities. Install friction is moderate due to libmongocrypt dependency, but pre-built wheels eliminate most setup overhead on common platforms. Apache 2.0 licensing poses no restrictions. Verify that your platform is supported by the pre-built wheels or plan for manual libmongocrypt installation.

Install

pymongocrypt on PyPI

pip

pip install pymongocrypt

uv

uv add pymongocrypt

poetry

poetry add pymongocrypt

Installing pymongocrypt

Before you install

Medium install friction due to platform-specific wheels (macOS, Windows, manylinux) and a compiled dependency on libmongocrypt. Wheels are provided for common platforms, but source installation requires manual libmongocrypt setup. Package is actively maintained with recent releases.

License in practice

Apache License 2.0 is permissive; you may use, modify, and distribute this package freely in commercial and open-source projects, provided you include a copy of the license and document any changes.

Quickstart

pip install pymongocrypt
import pymongocrypt
print(pymongocrypt.libmongocrypt_version())

libmongocrypt must be installed on your system or available via PYMONGOCRYPT_LIB environment variable; wheel installations on macOS, Windows, and manylinux include an embedded build, but source installs require manual setup.

Verify before relying

  • Whether the package works with PyPy3.9+ as stated in the description (classifiers only list CPython and PyPy, but no specific PyPy version bounds).
  • Performance characteristics of the embedded libmongocrypt build versus a system-installed build.

Package facts

License Apache License Version 2.0, January 2004 http://www.apache.org/licenses/ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 1. Definitions. "License" shall mean the terms and conditions for… (full text in the JSON record) (permissive)
Python support supports the current Python release (>=3.9)
Install friction medium — platform-specific wheel
Runtime dependencies 4 — cffi, cryptography, httpx, packaging
Maintenance actively maintained — 71 days since the last release
Last repo commit
First released
Downloads 1,284,344/month — #4,112 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: pymongocrypt-1.18.1-py3-none-macosx_11_0_universal2.whl; pymongocrypt-1.18.1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.manylinux_2_28_aarch64.whl; pymongocrypt-1.18.1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl; pymongocrypt-1.18.1-py3-none-win_amd64.whl

Keywords: bson, mongo, mongocrypt, mongodb, pymongo, pymongocrypt

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: Apache Software LicenseOperating System :: MacOS :: MacOS XOperating System :: Microsoft :: WindowsOperating System :: POSIXProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Programming Language :: Python :: 3.9Programming Language :: Python :: Implementation :: CPythonProgramming Language :: Python :: Implementation :: PyPyTopic :: Database

Tags

mongodb client-side encryptionpymongo encryption bindingslibmongocrypt python wrappermongodb csfle supportencrypted mongodb drivermongo field-level encryptionclient-side field encryption
encryptionmongodbcsfle

More Database packages