Skip to content

Commit b291807

Browse files
authored
PYTHON-5587 Remove check for dnspython version (#2566)
1 parent 8d45182 commit b291807

File tree

2 files changed

+2
-22
lines changed

2 files changed

+2
-22
lines changed

pymongo/asynchronous/srv_resolver.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import random
2020
from typing import TYPE_CHECKING, Any, Optional, Union
2121

22-
from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
22+
from pymongo.common import CONNECT_TIMEOUT
2323
from pymongo.errors import ConfigurationError
2424

2525
if TYPE_CHECKING:
@@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
3232
try:
3333
import dns # noqa: F401
3434

35-
dns_version, required_version, is_valid = check_for_min_version("dnspython")
36-
if not is_valid:
37-
raise RuntimeError(
38-
f"pymongo requires dnspython>={required_version}, "
39-
f"found version {dns_version}. "
40-
"Install a compatible version with pip"
41-
)
42-
4335
return True
4436
except ImportError:
4537
return False
@@ -79,8 +71,6 @@ def __init__(
7971
srv_service_name: str,
8072
srv_max_hosts: int = 0,
8173
):
82-
# Ensure the version of dnspython is compatible.
83-
_have_dnspython()
8474
self.__fqdn = fqdn
8575
self.__srv = srv_service_name
8676
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT

pymongo/synchronous/srv_resolver.py

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
import random
2020
from typing import TYPE_CHECKING, Any, Optional, Union
2121

22-
from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
22+
from pymongo.common import CONNECT_TIMEOUT
2323
from pymongo.errors import ConfigurationError
2424

2525
if TYPE_CHECKING:
@@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
3232
try:
3333
import dns # noqa: F401
3434

35-
dns_version, required_version, is_valid = check_for_min_version("dnspython")
36-
if not is_valid:
37-
raise RuntimeError(
38-
f"pymongo requires dnspython>={required_version}, "
39-
f"found version {dns_version}. "
40-
"Install a compatible version with pip"
41-
)
42-
4335
return True
4436
except ImportError:
4537
return False
@@ -79,8 +71,6 @@ def __init__(
7971
srv_service_name: str,
8072
srv_max_hosts: int = 0,
8173
):
82-
# Ensure the version of dnspython is compatible.
83-
_have_dnspython()
8474
self.__fqdn = fqdn
8575
self.__srv = srv_service_name
8676
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT

0 commit comments

Comments
 (0)