Skip to content

Commit dcb1327

Browse files
authored
PYTHON-3423 Make dnspython a required dependency (#1055)
1 parent 179efda commit dcb1327

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

README.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,11 @@ Dependencies
9090

9191
PyMongo supports CPython 3.7+ and PyPy3.7+.
9292

93+
Required dependencies:
94+
95+
Support for mongodb+srv:// URIs requires `dnspython
96+
<https://pypi.python.org/pypi/dnspython>`_
97+
9398
Optional dependencies:
9499

95100
GSSAPI authentication requires `pykerberos
@@ -104,10 +109,6 @@ MONGODB-AWS authentication requires `pymongo-auth-aws
104109

105110
$ python -m pip install "pymongo[aws]"
106111

107-
Support for mongodb+srv:// URIs requires `dnspython
108-
<https://pypi.python.org/pypi/dnspython>`_::
109-
110-
$ python -m pip install "pymongo[srv]"
111112

112113
OCSP (Online Certificate Status Protocol) requires `PyOpenSSL
113114
<https://pypi.org/project/pyOpenSSL/>`_, `requests

doc/changelog.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Changelog
44
Changes in Version 4.3
55
----------------------
66

7+
`dnspython <https://pypi.python.org/pypi/dnspython>`_ is now a required
8+
dependency. This change makes PyMongo easier to install for use with "mongodb+srv://"
9+
connection strings and `MongoDB Atlas <https://www.mongodb.com/cloud>`_.
10+
711
PyMongo 4.3 brings a number of improvements including:
812

913
- Added support for decoding BSON datetimes outside of the range supported

doc/installation.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ Dependencies
3030

3131
PyMongo supports CPython 3.7+ and PyPy3.7+.
3232

33+
Required dependencies:
34+
35+
Support for mongodb+srv:// URIs requires `dnspython
36+
<https://pypi.python.org/pypi/dnspython>`_
37+
38+
3339
Optional dependencies:
3440

3541
GSSAPI authentication requires `pykerberos
@@ -44,10 +50,7 @@ dependency can be installed automatically along with PyMongo::
4450

4551
$ python3 -m pip install "pymongo[aws]"
4652

47-
Support for mongodb+srv:// URIs requires `dnspython
48-
<https://pypi.python.org/pypi/dnspython>`_::
4953

50-
$ python3 -m pip install "pymongo[srv]"
5154

5255
:ref:`OCSP` requires `PyOpenSSL
5356
<https://pypi.org/project/pyOpenSSL/>`_, `requests

pymongo/uri_parser.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -469,8 +469,8 @@ def parse_uri(
469469
raise ConfigurationError(
470470
'The "dnspython" module must be '
471471
"installed to use mongodb+srv:// URIs. "
472-
"To fix this error install pymongo with the srv extra:\n "
473-
'%s -m pip install "pymongo[srv]"' % (python_path)
472+
"To fix this error install pymongo again:\n "
473+
"%s -m pip install pymongo>=4.3" % (python_path)
474474
)
475475
is_srv = True
476476
scheme_free = uri[SRV_SCHEME_LEN:]

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def build_extension(self, ext):
281281
"snappy": ["python-snappy"],
282282
"zstd": ["zstandard"],
283283
"aws": ["pymongo-auth-aws<2.0.0"],
284-
"srv": ["dnspython>=1.16.0,<3.0.0"],
284+
"srv": [],
285285
}
286286

287287
# GSSAPI extras
@@ -314,7 +314,7 @@ def build_extension(self, ext):
314314
author="The MongoDB Python Team",
315315
url="http://github.com/mongodb/mongo-python-driver",
316316
keywords=["mongo", "mongodb", "pymongo", "gridfs", "bson"],
317-
install_requires=[],
317+
install_requires=["dnspython>=1.16.0,<3.0.0"],
318318
license="Apache License, Version 2.0",
319319
python_requires=">=3.7",
320320
classifiers=[

0 commit comments

Comments
 (0)