These tools are experimental and subject to breaking changes.


Available since: 1.37.0

The BazelDeps helper will generate one conandeps/xxxx/BUILD file per dependency. This dependencies will be automatically added to the project by adding the following to the project’s WORKSPACE file:

load("@//conandeps:dependencies.bzl", "load_conan_dependencies")

The dependencies should be added to the file as usual:

class BazelExampleConan(ConanFile):
    name = "bazel-example"
    generators = "BazelDeps", "BazelToolchain"
    build_requires = "boost/1.76.0"


The Bazel build helper is a wrapper around the command line invocation of bazel. It will abstract the calls like bazel build //main:hello-world into Python method calls.

The helper is intended to be used in the build() method, to call Bazel commands automatically when a package is being built directly by Conan (create, install)

from conans import ConanFile
from import Bazel

class App(ConanFile):
    settings = "os", "arch", "compiler", "build_type"

    def build(self):
        bazel = Bazel(self)

It supports the following methods:


def __init__(self, conanfile):
  • conanfile: the current recipe object. Always use self.


def build(self, args=None, label=None):

Calls the build system. Equivalent to bazel build {label} in the build folder.