Thank you for your interest in contributing to MeshPi! This document provides guidelines and instructions for contributing.
- Python 3.9 or higher
- pip (Python package manager)
- git
- Make (optional, for convenience commands)
-
Fork and clone the repository
git clone https://github.com/YOUR_USERNAME/meshpi.git cd meshpi -
Create a virtual environment
python -m venv .venv source .venv/bin/activate # On Windows: .venv\Scripts\activate
-
Install development dependencies
pip install -e ".[dev]" -
Run tests to verify setup
make test # or pytest tests/ -v
# Run all tests
make test
# Run with coverage
make coverage
# Run specific test file
pytest tests/test_meshpi.py -v
# Run specific test
pytest tests/test_meshpi.py::test_parse_target -vMeshPi uses ruff for linting and formatting:
# Check for issues
make lint
# Auto-fix issues
ruff check --fix meshpi/
ruff format meshpi/We use mypy for static type checking:
mypy meshpi/-
Create a feature branch
git checkout -b feature/your-feature-name
-
Make your changes
- Write clean, documented code
- Add tests for new functionality
- Update documentation as needed
-
Run tests and linting
make test make lint -
Commit your changes
git commit -m "feat: description of your change"We follow Conventional Commits:
feat:- New featuresfix:- Bug fixesdocs:- Documentation changestest:- Test additions/changesrefactor:- Code refactoringchore:- Maintenance tasks
-
Push and create a PR
git push origin feature/your-feature-name
Then create a Pull Request on GitHub.
- Keep it simple - Write clear, readable code
- Document public APIs - Use docstrings for all public modules, classes, and functions
- Write tests - Aim for good test coverage of new functionality
- Handle errors gracefully - Provide helpful error messages
- Follow PEP 8 conventions
- Use type hints for function signatures
- Use f-strings for string formatting
- Use context managers for resource handling
from __future__ import annotations
from typing import Optional
def parse_target(target: str) -> tuple[str, str, int]:
"""
Parse a target string into user, host, and port components.
Args:
target: Target string like 'user@host:port' or 'host'
Returns:
Tuple of (user, host, port)
Raises:
ValueError: If target format is invalid
"""
# Implementation here
passHardware profiles are defined in meshpi/hardware/profiles.py. To add a new profile:
-
Create a
HardwareProfileinstance with required fields:id: Unique identifier (e.g.,oled_ssd1306_i2c)name: Human-readable namecategory: One of the defined categoriesdescription: Brief descriptionpackages: List of apt packages to installoverlays: Device tree overlayspost_commands: Shell commands to run after installation
-
Add tests for the new profile in
tests/test_meshpi.py
When reporting bugs, please include:
- MeshPi version (
meshpi --version) - Python version (
python --version) - Operating system
- Steps to reproduce
- Expected behavior
- Actual behavior
- Relevant logs (use
meshpi diagto collect)
For feature requests, please describe:
- The problem you're trying to solve
- Your proposed solution
- Any alternative solutions you've considered
- Any additional context
Maintainers follow these steps for releases:
- Update
VERSIONfile - Update
CHANGELOG.md - Create git tag:
git tag v1.x.x - Push tag:
git push --tags - GitHub Actions will build and publish to PyPI
- GitHub Issues: For bug reports and feature requests
- GitHub Discussions: For questions and general discussion
- Email: tom@sapletta.com
By contributing to MeshPi, you agree that your contributions will be licensed under the Apache License 2.0.
Thank you for contributing to MeshPi! 🎉