Skip to content

Latest commit

 

History

History
133 lines (88 loc) · 1.87 KB

File metadata and controls

133 lines (88 loc) · 1.87 KB

Contributing to OCPI Python


Requirements


Python Version Manager

We recommend using uv for managing Python versions and dependencies. Install uv:

curl -LsSf https://astral.sh/uv/install.sh | sh

Or using pip:

pip install uv

Python Version

Python >= 3.11

With uv, you can create a project with the correct Python version:

uv python install 3.11

Installation


Clone the project

git clone https://github.com/elumobility/ocpi-python.git

Go to the project directory

cd ocpi-python

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:

uv run <command>

Or activate the shell:

source .venv/bin/activate  # On Unix/macOS
# or
.venv\Scripts\activate  # On Windows

Install pre-commit

uv run pre-commit install

Running Tests


To run tests, use:

uv run pytest

Or with coverage:

uv run pytest --cov=ocpi --cov-report=term-missing

Building Documentation


To build documentation locally:

# Install docs dependencies first
uv sync --extra docs

# Build HTML documentation with MkDocs
uv run mkdocs build

# Serve documentation locally
uv run mkdocs serve

Development Workflow


  1. Create a feature branch
  2. Make your changes
  3. Run tests: uv run pytest
  4. Run linting: uv run ruff check .
  5. Run type checking: uv run mypy ocpi
  6. Commit your changes (pre-commit hooks will run automatically)
  7. Push and create a Pull Request