Contribution pathways
Three pathways exist for contributing to Mellea: Core repository — bug fixes, standard library additions (Requirements, Components, Sampling Strategies), backend improvements, documentation, and tests. Follow the Pull request process below. Applications and libraries — build tools or applications on top of Mellea in your own repository. Use themellea- prefix for discoverability (e.g., github.com/my-company/mellea-legal-utils).
Community components — contribute experimental or specialized components to mellea-contribs. Open an issue first for general-purpose additions to decide whether they belong in the standard library or in mellea-contribs.
Development setup
Set up with uv (recommended)
-
Fork and clone the repository:
-
Create a virtual environment:
-
Install dependencies:
-
Install pre-commit hooks (required):
Note: Python 3.13+ requires a Rust compiler for the outlines dependency. Use Python 3.12 if you prefer to avoid this.
Set up with conda or mamba
-
Fork and clone the repository:
-
Run the installation script:
The script handles environment setup, dependency installation, and pre-commit hook installation.
Verify the installation
Coding standards
Type annotations
Type annotations are required on all core functions:Docstrings
Docstrings serve as prompts — the LLM reads them, so be specific. Use Google-style docstrings:Code style
- Use Ruff for linting and formatting.
- Use
...in@generativefunction bodies. - Prefer primitives over classes.
- Keep functions focused and single-purpose.
Linting and formatting
Development workflow
Commit messages
Follow Angular commit format:feat, fix, docs, test, refactor, release
Example:
-s or --signoff:
feat/topic, fix/issue-id, docs/topic
Pre-commit hooks
Pre-commit hooks run automatically before each commit and check:- Ruff — linting and formatting
- mypy — type checking
- uv-lock — dependency lock file sync
- codespell — spell checking
Warning: pre-commit --all-files may take several minutes. Do not cancel mid-run as it can corrupt state.
Use the -n flag to bypass hooks for intermediate work-in-progress commits:
Testing
Test markers
Tests are categorized using pytest markers:| Marker | Requirement |
|---|---|
@pytest.mark.ollama | Ollama running locally (lightweight) |
@pytest.mark.huggingface | HuggingFace backend (local, heavy) |
@pytest.mark.vllm | vLLM backend (GPU required) |
@pytest.mark.openai | OpenAI API key |
@pytest.mark.watsonx | Watsonx API key |
@pytest.mark.litellm | LiteLLM backend |
@pytest.mark.requires_gpu | GPU available |
@pytest.mark.requires_heavy_ram | 48 GB+ RAM |
@pytest.mark.requires_api_key | External API key |
@pytest.mark.qualitative | LLM output quality (skipped in CI via CICD=1) |
@pytest.mark.llm | Makes LLM calls (needs at least Ollama) |
@pytest.mark.slow | Tests taking more than 5 minutes |
Warning: Do not addqualitativeto trivial tests — keep the fast loop fast. Mark tests taking more than 5 minutes withslow.
Running tests
Timing expectations
| Run | Duration |
|---|---|
Fast tests (-m "not qualitative") | ~2 minutes |
| Default (qualitative, no slow) | Several minutes |
Slow tests (-m slow) | More than 5 minutes |
| Pre-commit hooks | 1–5 minutes |
Replicate CI locally
Pull request process
- Create an issue describing your change (if one does not already exist).
- Fork the repository.
- Create a branch in your fork using the naming convention above.
- Make your changes following the coding standards.
- Add tests for new functionality.
- Run the test suite to confirm everything passes.
- Update documentation as needed.
- Push to your fork and open a pull request.
- Follow the automated PR workflow instructions in the PR template.
Troubleshooting
| Problem | Fix |
|---|---|
ComponentParseError | LLM output did not match expected type. Add examples to the docstring. |
uv.lock out of sync | Run uv sync to update the lock file. |
Ollama refused connection | Run ollama serve to start the Ollama server. |
ConnectionRefusedError (port 11434) | Ollama is not running. Start with ollama serve. |
TypeError: missing positional argument | First argument to a @generative function must be session m. |
| Output is wrong or None | Model too small or prompt insufficient. Try a larger model or add a reasoning field. |
error: can't find Rust compiler | Python 3.13+ requires Rust for outlines. Install Rust or use Python 3.12. |
| Tests fail on Intel Mac | Use conda: conda install 'torchvision>=0.22.0' then uv pip install mellea. |
| Pre-commit hooks fail | Run pre-commit run --all-files to see specific issues. Fix them, or use git commit -n to bypass. |
Debugging tips
Contributing to the docs
Documentation lives indocs/docs/. The writing guide at
docs/docs/guide/CONTRIBUTING covers conventions, the PR
checklist, and the review process for documentation contributions. Key points:
- Start body content with H2 — Mintlify renders the frontmatter
titleas the page heading. - Omit
.mdextensions from internal links. - Tag every fenced code block with a language.
- Run
npx markdownlint-cli2and fix all warnings before committing.
Getting help
- Check existing issues
- Join the Discord
- Open a new issue with the appropriate label
See also: Building Extensions