diff options
Diffstat (limited to 'examples/pip_parse/WORKSPACE')
-rw-r--r-- | examples/pip_parse/WORKSPACE | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/examples/pip_parse/WORKSPACE b/examples/pip_parse/WORKSPACE new file mode 100644 index 0000000..79aca14 --- /dev/null +++ b/examples/pip_parse/WORKSPACE @@ -0,0 +1,52 @@ +workspace(name = "rules_python_pip_parse_example") + +local_repository( + name = "rules_python", + path = "../..", +) + +load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains") + +py_repositories() + +python_register_toolchains( + name = "python39", + python_version = "3.9", +) + +load("@python39//:defs.bzl", "interpreter") +load("@rules_python//python:pip.bzl", "pip_parse") + +pip_parse( + # (Optional) You can set an environment in the pip process to control its + # behavior. Note that pip is run in "isolated" mode so no PIP_<VAR>_<NAME> + # style env vars are read, but env vars that control requests and urllib3 + # can be passed + # environment = {"HTTPS_PROXY": "http://my.proxy.fun/"}, + name = "pypi", + # (Optional) You can provide extra parameters to pip. + # Here, make pip output verbose (this is usable with `quiet = False`). + # extra_pip_args = ["-v"], + + # (Optional) You can exclude custom elements in the data section of the generated BUILD files for pip packages. + # Exclude directories with spaces in their names in this example (avoids build errors if there are such directories). + #pip_data_exclude = ["**/* */**"], + + # (Optional) You can provide a python_interpreter (path) or a python_interpreter_target (a Bazel target, that + # acts as an executable). The latter can be anything that could be used as Python interpreter. E.g.: + # 1. Python interpreter that you compile in the build file (as above in @python_interpreter). + # 2. Pre-compiled python interpreter included with http_archive + # 3. Wrapper script, like in the autodetecting python toolchain. + # + # Here, we use the interpreter constant that resolves to the host interpreter from the default Python toolchain. + python_interpreter_target = interpreter, + + # (Optional) You can set quiet to False if you want to see pip output. + #quiet = False, + requirements_lock = "//:requirements_lock.txt", +) + +load("@pypi//:requirements.bzl", "install_deps") + +# Initialize repositories for all packages in requirements_lock.txt. +install_deps() |