for requirement_file in requirements_dir.glob("*.txt"):
print(requirement_file.name)
with open(str(requirement_file), "r") as fd:
for req in requirements.parse(fd):
try:
version = pkg_resources.get_distribution(req.name).version
print(req.name.rjust(20), version)
except pkg_resources.DistributionNotFound:
print(req.name.rjust(20), "is not installed")
After Change
print(requirement_file.name)
with open(str(requirement_file), "r") as f:
for req in f:
req = req.strip()
if req[0] == "//":
continue
req = re.split("<|>|=|!|;", req)[0]
try: