Contributing to OCPI Python¶
We welcome contributions! This document provides guidelines for contributing to the project.
Requirements¶
Python Version Manager¶
We recommend using uv for managing Python versions and dependencies. Install uv:
Or using pip:
Python Version¶
Python >= 3.11
With uv, you can create a project with the correct Python version:
Installation¶
Clone the project¶
Go to the project directory¶
Install dependencies¶
# Install all dependencies including dev tools
uv sync --all-extras
# Or install specific extras
uv sync --extra dev --extra docs
This will:
- Create a virtual environment
- Install all dependencies from pyproject.toml
- Install development and documentation dependencies
Activate virtual environment¶
With uv, you can run commands in the virtual environment:
Or activate the shell:
Install pre-commit¶
Running Tests¶
To run tests, use:
Or with coverage:
Building Documentation¶
To build documentation locally:
# Install docs dependencies first
uv sync --extra docs
# Build and serve documentation
uv run mkdocs serve
# Build static site
uv run mkdocs build
Development Workflow¶
- Create a feature branch
- Make your changes
- Run tests:
uv run pytest - Run linting:
uv run ruff check . - Run type checking:
uv run mypy ocpi - Commit your changes (pre-commit hooks will run automatically)
- Push and create a Pull Request