Skip to content

Commit

Permalink
Add 'exclude' tuple to check_requirements() (ultralytics#2041)
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Jan 27, 2021
1 parent bb3409f commit f01d119
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions utils/general.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ def check_git_status():
print(e)


def check_requirements(file='requirements.txt'):
def check_requirements(file='requirements.txt', exclude=()):
# Check installed dependencies meet requirements
import pkg_resources
requirements = pkg_resources.parse_requirements(Path(file).open())
requirements = [x.name + ''.join(*x.specs) if len(x.specs) else x.name for x in requirements]
requirements = [f'{x.name}{x.specifier}' for x in pkg_resources.parse_requirements(Path(file).open())
if x.name not in exclude]
pkg_resources.require(requirements) # DistributionNotFound or VersionConflict exception if requirements not met


Expand Down

0 comments on commit f01d119

Please sign in to comment.