Skip to content

Commit 324d033

Browse files
committed
chore: Add CONTRIBUTINGmd
1 parent 3468b05 commit 324d033

File tree

1 file changed

+75
-0
lines changed

1 file changed

+75
-0
lines changed

CONTRIBUTING.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
# Contributing to python-roborock
2+
3+
Thank you for your interest in contributing to `python-roborock`! We welcome contributions from the community.
4+
5+
## Getting Started
6+
7+
1. **Fork the repository** on GitHub.
8+
2. **Clone your fork** locally:
9+
```bash
10+
git clone https://github.com/your-username/python-roborock.git
11+
cd python-roborock
12+
```
13+
3. **Set up your environment**. This project typically tries to stay on the most recent python versions (e.g. latest 2 or 3 versions). We use `uv` for dependency management:
14+
```bash
15+
# Create virtual environment and install dependencies
16+
uv venv
17+
uv sync
18+
```
19+
4. **Install pre-commit hooks**. This ensures your code meets our quality standards. Once installed, these hooks run automatically on staged files when you commit:
20+
```bash
21+
pre-commit install
22+
```
23+
24+
## Development Workflow
25+
26+
### Code Style
27+
28+
We use several tools to enforce code quality and consistency. These are configured via `pre-commit` and generally run automatically.
29+
30+
* **Ruff**: Used for linting and formatting.
31+
* **Mypy**: Used for static type checking.
32+
* **Codespell**: Checks for common misspellings.
33+
34+
You can verify your changes manually before committing (checks all files):
35+
36+
```bash
37+
# Run all pre-commit hooks
38+
pre-commit run --all-files
39+
```
40+
41+
### Testing
42+
43+
We use `pytest` for testing. Please ensure all tests pass and add new tests for your changes.
44+
45+
```bash
46+
# Run tests using uv
47+
uv run pytest
48+
```
49+
50+
## Pull Requests
51+
52+
1. **Create a branch** for your changes.
53+
2. **Make your changes**. Keep your changes focused and atomic.
54+
3. **Commit your changes**.
55+
* **Important**: We use [Conventional Commits](https://www.conventionalcommits.org/). Please format your commit messages accordingly (e.g., `feat: add new vacuum model`, `fix: handle connection timeout`). This is required for our automated release process.
56+
* Allowed types: `chore`, `docs`, `feat`, `fix`, `refactor`.
57+
4. **Push to your fork** and submit a **Pull Request**.
58+
59+
## Adding New Devices or Features
60+
61+
If you are adding support for a new device or feature, please follow these steps:
62+
63+
1. **Update Device Info**: Use the CLI to discover and fetch device features.
64+
```bash
65+
roborock get-device-info
66+
```
67+
Arguments and output will be printed to the console. **Manually copy the YAML output** from this command into the `device_info.yaml` file.
68+
69+
2. **Add Test Data**:
70+
* **Home API Data**: Capture device information from Home API responses and save as `tests/testdata/home_data_<device>.json`. This helps test device discovery and initialization.
71+
* **Protocol/Feature Data**: Capture actual device responses or protocol data. You can often see these messages in the DEBUG logs when interacting with the device. Create JSON files in `tests/protocols/testdata/` that reflect these responses. This ensures protocol parsing works correctly against real-world data.
72+
73+
## Code of Conduct
74+
75+
Please be respectful and considerate in your interactions.

0 commit comments

Comments
 (0)