Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Replace setuptools.extern.packaging with direct packaging import #913

Merged
merged 1 commit into from
Jul 24, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 3 additions & 7 deletions fury/deprecator.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,9 @@
import re
import warnings

from fury import __version__
from fury.optpkg import optional_package
from packaging import version

# packaging.version.parse is a third-party utility but is used by setuptools
# (so probably already installed) and is conformant to the current PEP 440.
# But just if it is not the case, we use distutils
packaging, have_pkg, _ = optional_package("setuptools.extern.packaging")
from fury import __version__

_LEADING_WHITE = re.compile(r"^(\s*)")

Expand Down Expand Up @@ -116,7 +112,7 @@ def cmp_pkg_version(version_str, pkg_version_str=__version__):
-1

"""
version_cmp = packaging.version.parse if have_pkg else None
version_cmp = version.parse

if any(re.match(r"^[a-z, A-Z]", v) for v in [version_str, pkg_version_str]):
msg = "Invalid version {0} or {1}".format(version_str, pkg_version_str)
Expand Down
Loading