From 4613e7a4b9c0900cdff1b4910c59a79900fa3264 Mon Sep 17 00:00:00 2001 From: Casey Clements Date: Mon, 29 Jan 2024 13:29:46 -0500 Subject: [PATCH] [ARROW-208] Replaced deprecated pkg_resource with packaging.version (#188) * Replaced deprecated pkg_resource with packaging.version --- bindings/python/pymongoarrow/__init__.py | 10 +++++++++- bindings/python/pyproject.toml | 4 ++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/bindings/python/pymongoarrow/__init__.py b/bindings/python/pymongoarrow/__init__.py index 171ea045..2f2333d9 100644 --- a/bindings/python/pymongoarrow/__init__.py +++ b/bindings/python/pymongoarrow/__init__.py @@ -17,10 +17,18 @@ # We must import pyarrow before attempting to load the Cython module. import pyarrow as pa # noqa: F401 -from packaging.version import parse as _parse_version from pymongoarrow.version import _MIN_LIBBSON_VERSION, __version__ # noqa: F401 +try: + from packaging.version import parse as _parse_version +except ImportError: + from distutils.version import LooseVersion as _LooseVersion + + def _parse_version(version): + return _LooseVersion(version) + + try: from pymongoarrow.lib import libbson_version except ImportError: diff --git a/bindings/python/pyproject.toml b/bindings/python/pyproject.toml index ee4cc0f3..d1828f13 100644 --- a/bindings/python/pyproject.toml +++ b/bindings/python/pyproject.toml @@ -105,6 +105,10 @@ filterwarnings = [ "error", # https://github.com/dateutil/dateutil/issues/1314 "module:datetime.datetime.utc:DeprecationWarning", + # https://jira.mongodb.org/browse/ARROW-204 + 'ignore:Passing a BlockManager to DataFrame is deprecated and will raise in a future version. Use public APIs instead.', + # https://jira.mongodb.org/browse/ARROW-206 + 'ignore:DatetimeTZBlock is deprecated and will be removed in a future version. Use public APIs instead.' ] [tool.ruff]