I am trying to create a wheel package from Bazel using py_wheel. py_wheel has the option to provide the required Python dependencies using the requires
attribute. This attribute accepts a list of strings as per the documentation. The format for this requires
list should be like :
requires = [
"foo == x.x.x",
"bar == x.x.x",
...
]
We are also maintaining a requirements.txt
file where we are already specifying these dependencies. The problem for us here is that we have to maintain these dependencies at two different places (in the BUILD file where py_wheel target is defined & the requirements file) which lead to maintenance overhead and is error-prone.
Is there a way that I can read my dependencies from the requirements.txt file and provide it as a list in Bazel?
py_wheel(
name = "dummy",
distribution = "dummy",
python_tag = "py3",
version = "latest",
requires = [?],
deps = [":dummy-dependencies"],
)
What I have already tried is the solution proposed here. The list of dependencies, created by using pip_parse
in the resulting requirements.bzl file is not in the format as specified for py_wheel rule. Due to this, the wheel does get created successfully but the wheel installation fails.