First off, thank you for considering contributing to MPLang! It's people like you that make MPLang such a great tool. We welcome any form of contribution, from documentation and bug reports to new features.
To get started, you'll need to set up your local environment for development.
You'll need the following tools installed:
-
uv: A fast Python package installer and resolver.
# Install uv on Linux/macOS curl -LsSf https://astral.sh/uv/install.sh | sh
-
buf: For Protobuf code generation.
# Install buf by following the official guide: https://buf.build/docs/installation
Once the prerequisites are installed, clone the repository and install the required Python packages for development in editable mode.
# Clone the repository
git clone https://github.com/secretflow/mplang.git
cd mplang
# Install dependencies, including development tools
uv sync --group dev
# Install the project in editable mode
uv pip install -e .If you edit .proto files under protos/, use these tools separately:
Buf (style/structure, build, codegen):
# Format files in place
buf format -w
# Style & naming lint
buf lint
# Validate schema and imports
buf build
# Generate stubs per buf.gen.yaml
buf generate
# Check breaking changes vs main
buf breaking --against '.git#branch=main'When you introduce new imports (for example, google/api/*.proto), ensure dependencies are up to date:
# After updating deps in buf.yaml if needed, refresh the lockfile
buf dep updateNotes:
- Protos live in
protos/. - Buf configs live at repo root:
buf.yamlandbuf.gen.yaml. - Generated Python files are written into the repo (out:
.), e.g. undermplang/protos/v1alpha1/. - Commit updated generated files together with your
.protochanges.
We use pytest for testing.
# Run all tests
uv run pytest
# Run tests in parallel for speed
uv run pytest -n auto
# Run a specific test file
uv run pytest tests/core/test_primitive.pyWe use ruff for linting and formatting, and mypy for static type checking. Please run these tools before submitting your changes.
# Format code
uv run ruff format .
# Lint and automatically fix issues
uv run ruff check . --fix
# Run the type checker
uv run mypy mplang/- Fork the repository and create a new branch for your feature or bug fix.
- Make your changes and ensure all tests and code quality checks pass.
- Push your branch and open a pull request against the
mainbranch. - Provide a clear description of your changes in the pull request.
Thank you for your contribution!