Thanks for your interest in contributing! This guide will get you from "I want to help" to your first pull request.
First time here? Check the Quick Start Guide to understand what the integration does and how it works.
Please create a Feature Request or Bug Report before starting work on a pull request. This ensures alignment and avoids duplicate effort.
| Tool | Version |
|---|---|
| Python | 3.13+ |
| pip | Latest |
| Git | Any recent version |
A UniFi device is helpful for end-to-end testing but not required — the test suite uses mocks.
# Clone the repository
git clone https://github.com/sirkirby/unifi-network-rules.git
cd unifi-network-rules
# Create a virtual environment and install dependencies
make venv
make installThis installs all runtime and development dependencies from requirements.txt, including:
homeassistant,aiounifi,aiohttp— runtime dependenciespytest,pytest-asyncio,pytest-cov— testingruff— linting and formatting
Run make help for the full list. The most important ones:
| Command | What It Does |
|---|---|
make venv |
Create a Python virtual environment |
make install |
Install all dependencies |
make lint |
Run Ruff linter |
make fix |
Auto-fix lint issues + format code |
make test |
Run the test suite |
make test-cov |
Run tests with coverage report |
make check |
Run all checks (lint + test) — run this before every PR |
Before submitting a PR, run:
make checkThis runs linting and tests — the same checks that CI will run. Your PR will not be merged if these fail.
The project uses Ruff for both linting and formatting, configured in pyproject.toml:
- Line length: 120 characters
- Python target: 3.13
- Quote style: double quotes
Run make fix to auto-format your code before committing.
- Create an issue (or find an existing one to work on)
- Fork and branch: Create a branch from
mainwith a descriptive name - Write code: Follow existing patterns in the codebase
- Write tests: Add or update tests in
tests/for your changes - Run checks:
make check— fix any failures - Submit PR: Reference the issue in your PR description
- References an existing issue
-
make checkpasses locally - Tests added or updated for the change
-
README.mdupdated if adding user-facing features -
manifest.jsonupdated if dependencies change
For manual API testing against a real UniFi device, the project maintains a Bruno collection with the same requests the integration makes. This is useful for verifying credentials and device compatibility.
For detailed coding standards, architectural patterns, and conventions, see the Constitution.
- 💬 Discussions — Questions and ideas
- 🐛 Issues — Bug reports
- 📖 README — Full project documentation
- 🔒 Security — Vulnerability reporting