pymongocrypt
Python bindings for libmongocrypt
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 pymongocryptuv
uv add pymongocryptpoetry
poetry add pymongocryptInstalling 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
Tags
More Database packages
psycopg2-binary is a PostgreSQL database…
copyleft · top 1,000 on PyPI
redisPython client library for connecting to and…
permissive · top 1,000 on PyPI
ydbYDB Python SDK is the official client library…
permissive · top 1,000 on PyPI
snowflake-connector-pythonConnects Python applications to Snowflake data…
permissive · top 1,000 on PyPI
sqlparsesqlparse tokenizes SQL text into a tree of…
permissive · top 1,000 on PyPI
dbt-adaptersProvides base adapter protocols and shared…
permissive · top 1,000 on PyPI
pymongoPyMongo is the official MongoDB Python driver,…
permissive · top 1,000 on PyPI
pymongo-auth-awsEnables PyMongo to authenticate to MongoDB…
permissive · top 5,000 on PyPI
Flask-PyMongoFlask-PyMongo integrates MongoDB database…
permissive · top 15,000 on PyPI
pymongo_inmemoryProvides an in-memory MongoDB instance for…
permissive · top 15,000 on PyPI
bsonEncodes and decodes BSON (Binary JSON) data…
permissive · top 5,000 on PyPI
mongomockMongomock provides an in-memory mock of MongoDB…
permissive · top 5,000 on PyPI
pymongoexplainWraps PyMongo's Collection class to explain…
permissive · top 15,000 on PyPI
pymongo-search-utilsProvides utility functions for vector search…
permissive · top 15,000 on PyPI
mongoengineMongoEngine provides an Object-Document Mapper…
permissive · top 5,000 on PyPI
motorMotor provides a non-blocking MongoDB driver…
permissive · top 5,000 on PyPI