Contributing

Thank you for taking the time to contribute to lametric-hass-local! This page describes how to set up your development environment, run quality gates, and submit a pull request.

Getting started

git clone https://github.com/ElectroAttacks/lametric-hass-local.git
cd lametric-hass-local
uv sync --dev
pre-commit install

uv is used as the project manager. It creates an isolated virtual environment and installs all dependencies including development extras.

Python version Local development requires Python 3.14.2 or later to satisfy the project's requires-python constraint.

Quality gates

All of the following must pass before a pull request can be merged.

Linting & formatting (Ruff)

uv run ruff check .
uv run ruff format .

Ruff enforces PEP 8 style and import ordering. Run ruff format . to auto-format before committing.

Type checking (Mypy)

uv run mypy .

Mypy is configured in strict mode. All public functions and methods must be fully annotated. Avoid Any unless necessary.

Test suite (Pytest)

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

Tests live in the tests/ directory. When adding new functionality, add or update tests to cover it. The CI pipeline requires all existing tests to pass.

Submitting a pull request

  1. Fork the repository and create a branch from main.
  2. Make your changes. Run all quality gates locally (see above).
  3. Commit using Conventional Commits. See the commit prefix table below.
  4. Open a pull request against main and fill in the pull request template.

Commit prefix reference

Prefix When to use Version bump
feat: New public API or user-facing capability minor
fix: Bug fix patch
perf: Performance improvement with no behaviour change patch
refactor: Internal restructuring, no observable behaviour change patch
docs: Documentation only
ci: Workflow or tooling changes
chore: Maintenance tasks, dependency bumps
Breaking changes Add BREAKING CHANGE: in the commit footer to trigger a major version bump.

Reporting issues

Before opening an issue, search existing issues to avoid duplicates. Use the appropriate template:

  • Bug report — something does not work as documented.
  • Feature request — propose a new capability or improvement.

For security vulnerabilities, do not open a public issue. See the Security page.

Translations

Translation strings are stored in custom_components/lametric_hass_local/translations/. If you add new UI strings, update en.json first. Additional language files are welcome; use the Home Assistant translation format.