Skip to content

Development

I recommend following (or at least reading) all the steps in this doc if you plan on actively developing Mesop.

Setup

Bazel/ibazel

We use Bazel as our build system. Use bazelisk which ensures the right version of Bazel is used for this project.

If ibazel breaks, but bazel works, try following these steps

TIP: If your build mysteriously fails due to an npm-related error, try running bazel clean --expunge && rm -rf node_modules. Bazel and Yarn have a cache bug when upgrading npm modules.

uv

We use uv. Follow the instructions here to install uv.

Commit hooks

  1. Install pre-commit
  2. Install pre-commit hooks for this repo: pre-commit install

Run local development

We recommend using this for most Mesop framework development.

./scripts/cli.sh

NOTE: this automatically serves the angular app.

Python

Third-party packages (PIP)

If you update //build_defs/requirements.txt, run:

bazel run //build_defs:pip_requirements.update

venv

To support IDE type-checking (Pylance) in VS Code, we use Aspect's rules_py which generates a venv target.

bazel run //mesop/cli:cli.venv

Then, you can activate the venv:

source .cli.venv/bin/activate

You will need to setup a symlink to have Python IDE support for protos:

./scripts/setup_proto_py_modules.sh

Check that you're using venv's python:

which python

Copy the python interpreter path and paste it into VS Code.

Finally, install third-party dependencies.

pip install -r build_defs/requirements_lock.txt

NOTE: You may need to run the command with sudo if you get a permission denied error, particularly with "_distutils_hack".

Commit hooks

We use pre-commit to automatically format, lint code before committing.

Setup:

  1. Install pre-commit.
  2. Setup git hook: pre-commit install

Docs

We use Mkdocs Material to generate our docs site.

  1. Activate venv
  2. mkdocs serve