MOTOR-1470 - Add Deprecation Warning to Motor

This commit is contained in:
Noah Stapp 2025-07-07 15:52:29 -04:00
parent 4f1962faf2
commit 88d13a647d
2 changed files with 16 additions and 0 deletions

View File

@ -85,6 +85,20 @@ class AgnosticBase:
def __init__(self, delegate):
self.delegate = delegate
warnings.warn(
DeprecationWarning(
"""As of May 14th, 2025,
Motor is deprecated in favor of the GA release of the PyMongo Async API.
No new features will be added to Motor,
and only bug fixes will be provided until it reaches end of life on May 14th, 2026.
After that, only critical bug fixes will be made until final support ends on May 14th, 2027.
We strongly recommend migrating to the PyMongo Async API while Motor is still supported.
For help transitioning, see the Migrate to PyMongo Async guide here:
https://www.mongodb.com/docs/languages/python/pymongo-driver/current/reference/migration/
"""
),
stacklevel=2,
)
def __repr__(self):
return f"{self.__class__.__name__}({self.delegate!r})"

View File

@ -103,6 +103,8 @@ filterwarnings = [
# TODO: Remove both of these in https://jira.mongodb.org/browse/PYTHON-4731
"ignore:Unclosed AsyncMongoClient*",
"ignore:Unclosed MongoClient*",
# Deprecation warning now that Motor is officially deprecated
"ignore:As of May 14th, 2025*",
]
[tool.ruff]