-
Notifications
You must be signed in to change notification settings - Fork 60
chore: Add CONTRIBUTING.md #734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| # Contributing to python-roborock | ||
|
|
||
| Thank you for your interest in contributing to `python-roborock`! We welcome contributions from the community. | ||
|
|
||
| ## Getting Started | ||
|
|
||
| 1. **Fork the repository** on GitHub. | ||
| 2. **Clone your fork** locally: | ||
| ```bash | ||
| git clone https://github.com/your-username/python-roborock.git | ||
| cd python-roborock | ||
| ``` | ||
| 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: | ||
| ```bash | ||
| # Create virtual environment and install dependencies | ||
| uv venv | ||
| uv sync | ||
| ``` | ||
| 4. **Activate the virtual environment**. This is required for running `pre-commit` hooks and `pytest`: | ||
| ```bash | ||
| source .venv/bin/activate | ||
| ``` | ||
|
|
||
| 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: | ||
| ```bash | ||
| pre-commit install | ||
| ``` | ||
|
|
||
| ## Development Workflow | ||
|
|
||
| ### Code Style | ||
|
|
||
| We use several tools to enforce code quality and consistency. These are configured via `pre-commit` and generally run automatically. | ||
|
|
||
| * **Ruff**: Used for linting and formatting. | ||
| * **Mypy**: Used for static type checking. | ||
| * **Codespell**: Checks for common misspellings. | ||
|
|
||
| You can verify your changes manually before committing (checks all files): | ||
|
|
||
| ```bash | ||
| # Run all pre-commit hooks | ||
| pre-commit run --all-files | ||
| ``` | ||
|
|
||
| ### Testing | ||
|
|
||
| We use `pytest` for testing. Please ensure all tests pass and add new tests for your changes. | ||
|
|
||
| ```bash | ||
| # Run tests | ||
| pytest | ||
| ``` | ||
|
|
||
| ## Pull Requests | ||
|
|
||
| 1. **Create a branch** for your changes. | ||
| 2. **Make your changes**. Keep your changes focused and atomic. | ||
| 3. **Commit your changes**. | ||
| * **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. | ||
| * Allowed types: `chore`, `docs`, `feat`, `fix`, `refactor`. | ||
| 4. **Push to your fork** and submit a **Pull Request**. | ||
|
|
||
| ## Adding New Devices or Features | ||
|
|
||
| If you are adding support for a new device or feature, please follow these steps: | ||
|
|
||
| 1. **Update Device Info**: Use the CLI to discover and fetch device features. | ||
| ```bash | ||
| roborock get-device-info | ||
| ``` | ||
| Arguments and output will be printed to the console. **Manually copy the YAML output** from this command into the `device_info.yaml` file. | ||
|
|
||
| 2. **Add Test Data**: | ||
| * **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. | ||
| * **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. | ||
|
|
||
| ## Code of Conduct | ||
|
|
||
| Please be respectful and considerate in your interactions. | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The CLI command should use hyphens instead of underscores. Click (the CLI framework used by this project) automatically converts underscores in Python function names to hyphens in the command-line interface. Since the function is named 'get_device_info', the actual command should be 'roborock get-device-info'.