This document will help you set up your local development environment and get started with contributing to the project. Contributions are much appreciated, but before starting on implementation of a new feature you are advised to create an issue for discussing your plans.
Before you begin, please ensure you have the following tools installed on your system:
- Python 3.x (Latest stable version recommended)
- Git (Latest version)
- Visual Studio Code (Recommended editor)
- Terminal/Command Prompt access
We use uv, a modern Python package manager that's significantly faster than pip and provides better dependency resolution.
-
First, install
uvby following the official installation guide -
Fork the repository:
- Visit https://github.com/nielsfaber/alarmo
- Click the "Fork" button in the top right
- Wait for GitHub to create your fork
-
Clone your fork:
git clone https://github.com/[your-username]/alarmo.git cd alarmo
Running the following commands will:
- Create a new virtual environment in
.venv - Install all project dependencies from
uv.lock - Set up pre-commit hooks for code quality checks
# Install dependencies and create virtual environment
uv sync
# Install pre-commit hooks
uv run pre-commit installTo ensure VSCode uses the correct Python environment:
- Open the Command Palette (Ctrl/Cmd + Shift + P)
- Type and select
Python: Select Interpreter - Choose the interpreter at
./.venv/bin/python
This will configure debugging, linting, and other Python features to use your project's environment.
One of the benefits of uv is that you don't need to manually activate the virtual environment. Here are some common commands:
# Run a Python script
uv run python ./script.py
# Run tests
uv run pytest tests
# Add a new dependency
uv add package_name
# Update dependencies
uv sync --upgradeTesting is crucial for maintaining code quality. Before submitting changes:
- Pre-commit hooks will automatically run tests when you commit
- Review the Test Documentation for writing new tests
Alarmo uses a file to manage Python versions:
pyproject.toml: Defines the compatible Python versions for the project
When updating Python versions:
- Update
pyproject.tomlwith your target version - Test thoroughly with the new version
While we recommend fixing issues identified by pre-commit, there may be situations where you need to bypass the hooks temporarily:
- During emergency hotfixes
- When committing work-in-progress changes
- When making documentation-only changes
You can bypass pre-commit hooks for a single commit using either:
# Long form
git commit -m "your message" --no-verify
# Short form
git commit -m "your message" -nImportant: After bypassing hooks:
- This should be used sparingly
- Run checks manually before pushing:
uv run pre-commit run --all-files
- Document the reason for bypassing in your commit message