From 5c7bc15ca5bdc8a450dd63d32ff8cd651fe5f3d7 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Thu, 27 Jun 2024 11:25:38 -0700 Subject: [PATCH] PYTHON-4529 Require pymongocrypt>=1.10 (#1714) --- doc/changelog.rst | 1 + pymongo/asynchronous/encryption.py | 2 +- pymongo/encryption_options.py | 3 +++ pymongo/synchronous/encryption.py | 2 +- requirements/encryption.txt | 2 +- 5 files changed, 7 insertions(+), 3 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 162e286b8..d2446ba78 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -7,6 +7,7 @@ Changes in Version 4.9.0 PyMongo 4.9 brings a number of improvements including: - A new asynchronous API with full asyncio support. +- pymongocrypt>=1.10 is now required for :ref:`In-Use Encryption` support. Issues Resolved ............... diff --git a/pymongo/asynchronous/encryption.py b/pymongo/asynchronous/encryption.py index 373efcea3..5977a83c4 100644 --- a/pymongo/asynchronous/encryption.py +++ b/pymongo/asynchronous/encryption.py @@ -574,7 +574,7 @@ class ClientEncryption(Generic[_DocumentType]): raise ConfigurationError( "client-side field level encryption requires the pymongocrypt " "library: install a compatible version with: " - "python -m pip install 'pymongo[encryption]'" + "python -m pip install --upgrade 'pymongo[encryption]'" ) if not isinstance(codec_options, CodecOptions): diff --git a/pymongo/encryption_options.py b/pymongo/encryption_options.py index f12e6e6f7..b399cb0d4 100644 --- a/pymongo/encryption_options.py +++ b/pymongo/encryption_options.py @@ -20,6 +20,9 @@ from typing import TYPE_CHECKING, Any, Mapping, Optional try: import pymongocrypt # type:ignore[import] # noqa: F401 + # Check for pymongocrypt>=1.10. + from pymongocrypt import synchronous as _ # noqa: F401 + _HAVE_PYMONGOCRYPT = True except ImportError: _HAVE_PYMONGOCRYPT = False diff --git a/pymongo/synchronous/encryption.py b/pymongo/synchronous/encryption.py index a099cbfc9..a04087449 100644 --- a/pymongo/synchronous/encryption.py +++ b/pymongo/synchronous/encryption.py @@ -572,7 +572,7 @@ class ClientEncryption(Generic[_DocumentType]): raise ConfigurationError( "client-side field level encryption requires the pymongocrypt " "library: install a compatible version with: " - "python -m pip install 'pymongo[encryption]'" + "python -m pip install --upgrade 'pymongo[encryption]'" ) if not isinstance(codec_options, CodecOptions): diff --git a/requirements/encryption.txt b/requirements/encryption.txt index bae6115eb..1a8c14844 100644 --- a/requirements/encryption.txt +++ b/requirements/encryption.txt @@ -1,3 +1,3 @@ pymongo-auth-aws>=1.1.0,<2.0.0 -pymongocrypt>=1.6.0,<2.0.0 +pymongocrypt>=1.10.0,<2.0.0 certifi;os.name=='nt' or sys_platform=='darwin'