Skip to content

Commit

Permalink
Use compose to model a valid requirement string.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Dec 30, 2022
1 parent abe1aa0 commit ed84f7b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pip_run/scripts.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
import packaging.requirements
import jaraco.text
from jaraco.context import suppress
from jaraco.functools import compose


ValidRequirementString = compose(str, packaging.requirements.Requirement)


class Dependencies(list):
Expand All @@ -22,9 +26,7 @@ def load(cls, items):
"""
Construct self from items, validated as requirements.
"""
reqs = map(packaging.requirements.Requirement, items)
strings = map(str, reqs)
return cls(strings)
return cls(map(ValidRequirementString, items))


class DepsReader:
Expand Down
1 change: 1 addition & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ install_requires =
jaraco.text
platformdirs
importlib_resources; python_version < "3.9"
jaraco.functools

[options.packages.find]
exclude =
Expand Down

0 comments on commit ed84f7b

Please sign in to comment.