Skip to content

Commit

Permalink
remove useage of the deprecated pkg_resources (#4701)
Browse files Browse the repository at this point in the history
setup.py: make clear that Python 3.7 is no longer supported

Co-authored-by: Lon Blauvelt <[email protected]>
  • Loading branch information
mr-c and DailyDreaming authored Nov 29, 2023
1 parent c4112f6 commit 03b42a6
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def run_setup():
'Topic :: System :: Distributed Computing',
'Topic :: Utilities'],
license="Apache License v2.0",
python_requires=">=3.7",
python_requires=">=3.8",
install_requires=install_requires,
extras_require=extras_require,
package_dir={'': 'src'},
Expand Down
11 changes: 3 additions & 8 deletions src/toil/cwl/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
import sys
from functools import lru_cache

from pkg_resources import DistributionNotFound, get_distribution
from importlib.metadata import version, PackageNotFoundError

try:
# Setuptools 66+ will raise this if any package on the system has a version that isn't PEP440.
Expand All @@ -39,19 +39,14 @@ def check_cwltool_version() -> None:
warning will be printed.
"""
try:
installed_version = get_distribution("cwltool").version
installed_version = version("cwltool")

if installed_version != cwltool_version:
sys.stderr.write(
f"WARNING: You are using cwltool version {installed_version}, which is "
f"not the version Toil is tested against. To install the correct cwltool "
f"for Toil, do:\n\n\tpip install cwltool=={cwltool_version}\n\n"
)
except DistributionNotFound:
except PackageNotFoundError:
# cwltool is not installed
pass
except InvalidVersion as e:
sys.stderr.write(
f"WARNING: Could not determine the installed version of cwltool because a package "
f"with an unacceptable version is installed: {e}\n"
)
4 changes: 2 additions & 2 deletions src/toil/utils/toilMain.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import types
from typing import Any, Dict

import pkg_resources
from importlib.metadata import version as metadata_version

from toil.version import version

Expand Down Expand Up @@ -78,6 +78,6 @@ def printHelp(modules: Dict[str, types.ModuleType]) -> None:

def printVersion() -> None:
try:
print(pkg_resources.get_distribution('toil').version)
print(metadata_version('toil'))
except:
print(f'Version gathered from toil.version: {version}')
4 changes: 0 additions & 4 deletions version_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,6 @@ def mainCacheTag():

def distVersion():
"""The distribution version identifying a published release on PyPI."""
from pkg_resources import parse_version
if isinstance(parse_version(baseVersion), tuple):
raise RuntimeError("Setuptools version 8.0 or newer required. Update by running "
"'pip install setuptools --upgrade'")
return baseVersion


Expand Down

0 comments on commit 03b42a6

Please sign in to comment.