Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion docs/venv.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 3 additions & 1 deletion py/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ py_image_layer = _py_image_layer

resolutions = _resolutions

def _py_binary_or_test(name, rule, srcs, main, deps = [], resolutions = {}, **kwargs):
def _py_binary_or_test(name, rule, srcs, main, data = [], deps = [], resolutions = {}, **kwargs):
# Compatibility with rules_python, see docs in py_executable.bzl
main_target = "{}.find_main".format(name)
determine_main(
Expand All @@ -76,6 +76,7 @@ def _py_binary_or_test(name, rule, srcs, main, deps = [], resolutions = {}, **kw
name = name,
srcs = srcs,
main = main_target,
data = data,
deps = deps,
resolutions = resolutions,
package_collisions = package_collisions,
Expand All @@ -84,6 +85,7 @@ def _py_binary_or_test(name, rule, srcs, main, deps = [], resolutions = {}, **kw

_py_venv(
name = "{}.venv".format(name),
data = data,
deps = deps,
imports = kwargs.get("imports"),
resolutions = resolutions,
Expand Down
9 changes: 9 additions & 0 deletions py/private/py_venv.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ py_venv_rule = rule(
allow_files = True,
providers = [[PyInfo], [PyVirtualInfo]],
),
"data": attr.label_list(
doc = """Runtime dependencies of the program.

The transitive closure of the `data` dependencies will be available in the `.runfiles`
folder for this binary/test. The program may optionally use the Runfiles lookup library to
locate the data files, see https://pypi.org/project/bazel-runfiles/.
""",
allow_files = True,
),
"imports": attr.string_list(
doc = "List of import directories to be added to the PYTHONPATH.",
default = [],
Expand Down