Skip to content

Commit 881b7d6

Browse files
authored
chore: Add CONTRIBUTING.md (#734)
* chore: Add CONTRIBUTINGmd * chore: Update steps to activate virtual environment
1 parent 3468b05 commit 881b7d6

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

CONTRIBUTING.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
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. **Activate the virtual environment**. This is required for running `pre-commit` hooks and `pytest`:
20+
```bash
21+
source .venv/bin/activate
22+
```
23+
24+
5. **Install pre-commit hooks**. This ensures your code meets our quality standards. Once installed, these hooks run automatically on staged files when you commit:
25+
```bash
26+
pre-commit install
27+
```
28+
29+
## Development Workflow
30+
31+
### Code Style
32+
33+
We use several tools to enforce code quality and consistency. These are configured via `pre-commit` and generally run automatically.
34+
35+
* **Ruff**: Used for linting and formatting.
36+
* **Mypy**: Used for static type checking.
37+
* **Codespell**: Checks for common misspellings.
38+
39+
You can verify your changes manually before committing (checks all files):
40+
41+
```bash
42+
# Run all pre-commit hooks
43+
pre-commit run --all-files
44+
```
45+
46+
### Testing
47+
48+
We use `pytest` for testing. Please ensure all tests pass and add new tests for your changes.
49+
50+
```bash
51+
# Run tests
52+
pytest
53+
```
54+
55+
## Pull Requests
56+
57+
1. **Create a branch** for your changes.
58+
2. **Make your changes**. Keep your changes focused and atomic.
59+
3. **Commit your changes**.
60+
* **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.
61+
* Allowed types: `chore`, `docs`, `feat`, `fix`, `refactor`.
62+
4. **Push to your fork** and submit a **Pull Request**.
63+
64+
## Adding New Devices or Features
65+
66+
If you are adding support for a new device or feature, please follow these steps:
67+
68+
1. **Update Device Info**: Use the CLI to discover and fetch device features.
69+
```bash
70+
roborock get-device-info
71+
```
72+
Arguments and output will be printed to the console. **Manually copy the YAML output** from this command into the `device_info.yaml` file.
73+
74+
2. **Add Test Data**:
75+
* **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.
76+
* **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.
77+
78+
## Code of Conduct
79+
80+
Please be respectful and considerate in your interactions.

0 commit comments

Comments
 (0)