Skip to content

Commit

Permalink
Merge pull request #258 from neutrinoceros/dep/ditch_setuptools
Browse files Browse the repository at this point in the history
DEP: refactored out runtime dependency on setuptools
  • Loading branch information
pllim authored Jul 19, 2024
2 parents ab82f3b + dd104ac commit 962de7f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
==================

- Fixing output update for multiline code. [#253]
- Dropped ``setuptools`` as a runtime dependency. [#258]

1.2.1 (2024-03-09)
==================
Expand Down
12 changes: 9 additions & 3 deletions pytest_doctestplus/utils.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import importlib.util

import pkg_resources

from importlib.metadata import distribution
from packaging.requirements import Requirement

class ModuleChecker:

Expand All @@ -15,9 +15,15 @@ def find_module(self, module):
def find_distribution(self, dist):
"""Search for distribution with specified version (eg 'numpy>=1.15')."""
try:
return pkg_resources.require(dist)
reqs = Requirement(dist)
dist_meta = distribution(reqs.name)
except Exception:
return None
else:
if reqs.specifier.contains(dist_meta.version, prereleases=True):
return dist_meta
else:
return None

def check(self, module):
"""
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ setup_requires =
setuptools_scm
install_requires =
pytest>=4.6
setuptools>=30.3.0
packaging>=17.0

[options.extras_require]
test =
numpy
pytest-remotedata>=0.3.2
setuptools>=30.3.0
sphinx

[options.entry_points]
Expand Down

0 comments on commit 962de7f

Please sign in to comment.