Contributing
We welcome contributions to the UniFi Controller API project! This document outlines the process for contributing.
Development Environment
Fork the repository on GitHub
Clone your fork locally:
git clone https://github.com/your-username/unifi-controller-api.git cd unifi-controller-api
Install development dependencies:
pip install -e ".[dev]"
Create a branch for your changes:
git checkout -b your-feature-branch
Testing
Run tests with pytest:
pytest
For coverage:
pytest --cov=unifi_controller_api tests/
Code Style
This project uses ruff for code linting. Run linting with:
ruff check .
Documentation
Build the documentation locally to preview your changes:
# Install documentation dependencies if needed
pip install -e ".[docs]"
# Build docs
cd docs
make html
Pull Request Process
Ensure your code passes all tests
Update documentation as needed
Add or update tests for new functionality
Submit a Pull Request against the main repository
Describe your changes in detail
Documentation Standards
Use Google-style docstrings for Python code
Include type annotations where appropriate
Document parameters, return values, and exceptions raised
Provide usage examples for complex functionality
Example docstring format:
def function_name(param1: type, param2: type) -> return_type:
"""Short description of the function.
More detailed description if needed.
Args:
param1: Description of param1
param2: Description of param2
Returns:
Description of return value
Raises:
ExceptionType: When and why this exception is raised
Example:
>>> function_name("example", 123)
"result"
"""
# Function implementation