Skip to content

Commit

Permalink
Make requirements.txt single source of truth (#414)
Browse files Browse the repository at this point in the history
Summary:
Hi, this fixes #410.

Pull Request resolved: #414

Reviewed By: ejguan

Differential Revision: D36445769

Pulled By: NivekT

fbshipit-source-id: 929a0d3160f62c5da64c429012862710447e5220
  • Loading branch information
tal66 authored and facebook-github-bot committed May 17, 2022
1 parent 5028134 commit ea82294
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,18 +98,26 @@ def _export_version(version, sha):
f.write(f"git_version = {repr(sha)}\n")


def _get_requirements():
req_list = []
with Path("requirements.txt").open("r") as f:
for line in f:
req = line.strip()
if len(req) == 0 or req.startswith("#"):
continue
req_list.append(req)
return req_list


# Use new version of torch on main branch
pytorch_package_dep = "torch>1.11.0"
if os.getenv("PYTORCH_VERSION"):
pytorch_package_dep = pytorch_package_dep.split(">")[0]
pytorch_package_dep += "==" + os.getenv("PYTORCH_VERSION")


requirements = [
"urllib3 >= 1.25",
"requests",
pytorch_package_dep,
]
requirements = _get_requirements()
requirements.append(pytorch_package_dep)


class clean(distutils.command.clean.clean):
Expand Down

0 comments on commit ea82294

Please sign in to comment.