From dcb1327395c96b6401492737db9e923d8577b35e Mon Sep 17 00:00:00 2001 From: Julius Park Date: Thu, 15 Sep 2022 13:31:45 -0700 Subject: [PATCH] PYTHON-3423 Make dnspython a required dependency (#1055) --- README.rst | 9 +++++---- doc/changelog.rst | 4 ++++ doc/installation.rst | 9 ++++++--- pymongo/uri_parser.py | 4 ++-- setup.py | 4 ++-- 5 files changed, 19 insertions(+), 11 deletions(-) diff --git a/README.rst b/README.rst index f60b8da68..576facb5b 100644 --- a/README.rst +++ b/README.rst @@ -90,6 +90,11 @@ Dependencies PyMongo supports CPython 3.7+ and PyPy3.7+. +Required dependencies: + +Support for mongodb+srv:// URIs requires `dnspython +`_ + Optional dependencies: GSSAPI authentication requires `pykerberos @@ -104,10 +109,6 @@ MONGODB-AWS authentication requires `pymongo-auth-aws $ python -m pip install "pymongo[aws]" -Support for mongodb+srv:// URIs requires `dnspython -`_:: - - $ python -m pip install "pymongo[srv]" OCSP (Online Certificate Status Protocol) requires `PyOpenSSL `_, `requests diff --git a/doc/changelog.rst b/doc/changelog.rst index 7107e5733..24c80efa2 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -4,6 +4,10 @@ Changelog Changes in Version 4.3 ---------------------- +`dnspython `_ is now a required +dependency. This change makes PyMongo easier to install for use with "mongodb+srv://" +connection strings and `MongoDB Atlas `_. + PyMongo 4.3 brings a number of improvements including: - Added support for decoding BSON datetimes outside of the range supported diff --git a/doc/installation.rst b/doc/installation.rst index 788faf46c..4355f771e 100644 --- a/doc/installation.rst +++ b/doc/installation.rst @@ -30,6 +30,12 @@ Dependencies PyMongo supports CPython 3.7+ and PyPy3.7+. +Required dependencies: + +Support for mongodb+srv:// URIs requires `dnspython +`_ + + Optional dependencies: GSSAPI authentication requires `pykerberos @@ -44,10 +50,7 @@ dependency can be installed automatically along with PyMongo:: $ python3 -m pip install "pymongo[aws]" -Support for mongodb+srv:// URIs requires `dnspython -`_:: - $ python3 -m pip install "pymongo[srv]" :ref:`OCSP` requires `PyOpenSSL `_, `requests diff --git a/pymongo/uri_parser.py b/pymongo/uri_parser.py index cd18c067e..f59af2e74 100644 --- a/pymongo/uri_parser.py +++ b/pymongo/uri_parser.py @@ -469,8 +469,8 @@ def parse_uri( raise ConfigurationError( 'The "dnspython" module must be ' "installed to use mongodb+srv:// URIs. " - "To fix this error install pymongo with the srv extra:\n " - '%s -m pip install "pymongo[srv]"' % (python_path) + "To fix this error install pymongo again:\n " + "%s -m pip install pymongo>=4.3" % (python_path) ) is_srv = True scheme_free = uri[SRV_SCHEME_LEN:] diff --git a/setup.py b/setup.py index 0e983e464..524c1303e 100755 --- a/setup.py +++ b/setup.py @@ -281,7 +281,7 @@ extras_require = { "snappy": ["python-snappy"], "zstd": ["zstandard"], "aws": ["pymongo-auth-aws<2.0.0"], - "srv": ["dnspython>=1.16.0,<3.0.0"], + "srv": [], } # GSSAPI extras @@ -314,7 +314,7 @@ setup( author="The MongoDB Python Team", url="http://github.com/mongodb/mongo-python-driver", keywords=["mongo", "mongodb", "pymongo", "gridfs", "bson"], - install_requires=[], + install_requires=["dnspython>=1.16.0,<3.0.0"], license="Apache License, Version 2.0", python_requires=">=3.7", classifiers=[