WORKSPACE setup
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "rules_conda",
sha256 = "f5c5e6be86ddc28ef2ed9163878f5a073defc5d79b82e60570f502549c9ef602",
url = "https://github.com/spietras/rules_conda/releases/download/0.0.1/rules_conda-0.0.1.zip"
)
load("@rules_conda//:defs.bzl", "load_conda", "conda_create", "register_toolchain")
# download and install conda
load_conda(
version="4.8.4" # optional, defaults to 4.8.4
)
# create environment with python2
conda_create(
name = "py2_env",
environment = "@//third_party/conda:py2_environment.yml" # label pointing to environment.yml file
)
# create environment with python3
conda_create(
name = "py3_env",
environment = "@//third_party/conda:py3_environment.yml" # label pointing to environment.yml file
)
# register pythons from environment as toolchain
register_toolchain(
py2_env = "py2_env", # python2 is optional
py3_env = "py3_env"
)