PYTHON-5587 Remove check for dnspython version (#2566)

This commit is contained in:
Steven Silvester 2025-09-30 11:39:51 -05:00 committed by GitHub
parent 8d4518287c
commit b291807106
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 2 additions and 22 deletions

View File

@ -19,7 +19,7 @@ import ipaddress
import random
from typing import TYPE_CHECKING, Any, Optional, Union
from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
from pymongo.common import CONNECT_TIMEOUT
from pymongo.errors import ConfigurationError
if TYPE_CHECKING:
@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
try:
import dns # noqa: F401
dns_version, required_version, is_valid = check_for_min_version("dnspython")
if not is_valid:
raise RuntimeError(
f"pymongo requires dnspython>={required_version}, "
f"found version {dns_version}. "
"Install a compatible version with pip"
)
return True
except ImportError:
return False
@ -79,8 +71,6 @@ class _SrvResolver:
srv_service_name: str,
srv_max_hosts: int = 0,
):
# Ensure the version of dnspython is compatible.
_have_dnspython()
self.__fqdn = fqdn
self.__srv = srv_service_name
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT

View File

@ -19,7 +19,7 @@ import ipaddress
import random
from typing import TYPE_CHECKING, Any, Optional, Union
from pymongo.common import CONNECT_TIMEOUT, check_for_min_version
from pymongo.common import CONNECT_TIMEOUT
from pymongo.errors import ConfigurationError
if TYPE_CHECKING:
@ -32,14 +32,6 @@ def _have_dnspython() -> bool:
try:
import dns # noqa: F401
dns_version, required_version, is_valid = check_for_min_version("dnspython")
if not is_valid:
raise RuntimeError(
f"pymongo requires dnspython>={required_version}, "
f"found version {dns_version}. "
"Install a compatible version with pip"
)
return True
except ImportError:
return False
@ -79,8 +71,6 @@ class _SrvResolver:
srv_service_name: str,
srv_max_hosts: int = 0,
):
# Ensure the version of dnspython is compatible.
_have_dnspython()
self.__fqdn = fqdn
self.__srv = srv_service_name
self.__connect_timeout = connect_timeout or CONNECT_TIMEOUT