diff --git a/docs/pip.md b/docs/pip.md
index 73035fdfef..8d8b0f5c9b 100755
--- a/docs/pip.md
+++ b/docs/pip.md
@@ -5,7 +5,7 @@
## pip_import
-pip_import(name, extra_pip_args, python_interpreter, requirements)
+pip_import(name, extra_pip_args, python_interpreter, requirements, timeout)
A rule for importing `requirements.txt` dependencies into Bazel.
@@ -95,6 +95,15 @@ wheels.
+
+ timeout |
+
+ Integer; optional
+
+ Timeout (in seconds) for repository fetch.
+
+ |
+
diff --git a/python/pip.bzl b/python/pip.bzl
index cae023f646..60793fd33b 100644
--- a/python/pip.bzl
+++ b/python/pip.bzl
@@ -43,7 +43,7 @@ def _pip_import_impl(repository_ctx):
]
# To see the output, pass: quiet=False
- result = repository_ctx.execute(args)
+ result = repository_ctx.execute(args, timeout=repository_ctx.attr.timeout)
if result.return_code:
fail("pip_import failed: %s (%s)" % (result.stdout, result.stderr))
@@ -62,6 +62,10 @@ wheels.
allow_single_file = True,
doc = "The label of the requirements.txt file.",
),
+ "timeout": attr.int(
+ default = 600,
+ doc = "Timeout (in seconds) for repository fetch."
+ ),
"_script": attr.label(
executable = True,
default = Label("//tools:piptool.par"),