Multi-language Bazel monorepo template supporting Go, Python, and C++ projects.
This repository provides a standardized development environment using Bazel, ensuring consistent tooling across all developers.
- Git
- curl
The repository includes an environment setup script that creates an isolated shell with all necessary tools and configurations:
./env
This will:
- Create an isolated shell environment
- Add the repository's
bin/
directory to your PATH - Download and configure bazelisk (a version manager for Bazel)
- Set up a Python virtual environment
- Provide hermetic Bazel versions for each supported language tools
The environment is isolated, meaning:
- Only essential environment variables are preserved
- A new clean shell is started with minimal configuration
- The prompt will indicate you're in the development environment
- You cannot start nested environments
To exit the environment, simply type exit
or press Ctrl+D
.
This repository uses Bazel as its build system.
We use Gazelle to automatically manage Bazel BUILD files for Go code. To update BUILD files after adding or modifying Go code:
bazel run //:gazelle
To add new Python dependencies:
- Add them to
requirements.txt
- Run the following command to update the lock file:
bazel run //:requirements.update
- Run the following command to update the manifest file:
bazel run //:gazelle_python_manifest.update
- Run the following command to update the BUILD files:
bazel run //:gazelle
To build a specific target:
bazel build //path/to/target
To run a target:
bazel run //path/to/target
For example, to run the hello world program:
bazel run //src/go/helloworld
.
├── bin/ # Development tools and scripts
├── src/
│ ├── go/ # Go source code
│ │ └── helloworld/ # Example Go program
│ └── python/ # Python source code
│ └── helloworld/ # Example Python program
└── BUILD.bazel # Root Bazel build file