|
| 1 | +# Contributing to ONVIF Python |
| 2 | + |
| 3 | +Thank you for your interest in contributing to the ONVIF Python project! We welcome contributions from everyone—whether you're a seasoned developer, a device integrator, or a first-time open source participant. Your feedback, code, documentation, and ideas help make this project better for the entire community. |
| 4 | + |
| 5 | +## Table of Contents |
| 6 | +- [How to Contribute](#how-to-contribute) |
| 7 | +- [Code of Conduct](#code-of-conduct) |
| 8 | +- [Ways to Contribute](#ways-to-contribute) |
| 9 | +- [Development Setup](#development-setup) |
| 10 | +- [Pull Request Guidelines](#pull-request-guidelines) |
| 11 | +- [Reporting Issues](#reporting-issues) |
| 12 | +- [Style Guide](#style-guide) |
| 13 | +- [Documentation](#documentation) |
| 14 | +- [Community & Support](#community--support) |
| 15 | +- [License](#license) |
| 16 | + |
| 17 | +## How to Contribute |
| 18 | + |
| 19 | +1. **Fork the repository** on GitHub and clone your fork locally. |
| 20 | +2. **Create a new branch** for your feature, fix, or documentation update. |
| 21 | +3. **Make your changes** with clear, descriptive commit messages. |
| 22 | +4. **Test your changes** to ensure they work as expected and do not break existing functionality. |
| 23 | +5. **Push your branch** to your fork and open a Pull Request (PR) against the `main` branch of this repository. |
| 24 | +6. **Participate in code review** by responding to feedback and making necessary updates. |
| 25 | + |
| 26 | +## Code of Conduct |
| 27 | + |
| 28 | +All contributors are expected to follow our [Code of Conduct](./CODE_OF_CONDUCT.md), which is based on the [CNCF Foundation Code of Conduct](https://github.com/cncf/foundation/blob/main/code-of-conduct.md). Please treat everyone with respect and foster a welcoming, inclusive environment. |
| 29 | + |
| 30 | +## Ways to Contribute |
| 31 | + |
| 32 | +- **Bug Reports:** If you find a bug, please [open an issue](https://github.com/nirsimetri/onvif-python/issues) with clear steps to reproduce, expected behavior, and environment details. |
| 33 | +- **Feature Requests:** Suggest new features or improvements by opening an issue and describing your use case and desired functionality. |
| 34 | +- **Code Contributions:** Submit fixes, enhancements, or new features via Pull Requests. See [Development Setup](#development-setup) and [Pull Request Guidelines](#pull-request-guidelines). |
| 35 | +- **Documentation:** Help improve the README, usage examples, or API documentation. Well-written docs are as valuable as code! |
| 36 | +- **Testing:** Add or improve unit and integration tests to ensure reliability and compatibility. |
| 37 | +- **Device Testing:** Share your experience with different ONVIF devices by contributing results to the [device-test](https://github.com/nirsimetri/onvif-products/blob/main/device-test) list. |
| 38 | +- **Translations:** If you can help translate documentation or error messages, let us know! |
| 39 | + |
| 40 | +## Development Setup |
| 41 | + |
| 42 | +1. **Clone the repository:** |
| 43 | + ```bash |
| 44 | + git clone https://github.com/nirsimetri/onvif-python.git |
| 45 | + cd onvif-python |
| 46 | + ``` |
| 47 | +2. **Install locally:** |
| 48 | + ```bash |
| 49 | + pip install . |
| 50 | + ``` |
| 51 | + Or use `pyproject.toml` with your preferred tool (e.g., Poetry, pip). |
| 52 | +3. (Optional) **Run tests:** |
| 53 | + ```bash |
| 54 | + pytest |
| 55 | + ``` |
| 56 | +4. (Optional) **Lint and format code:** |
| 57 | + ```bash |
| 58 | + flake8 . |
| 59 | + black . |
| 60 | + ``` |
| 61 | +5. **Try example scripts:** |
| 62 | + See the [`examples/`](./examples/) folder for usage scenarios. |
| 63 | + |
| 64 | +## Pull Request Guidelines |
| 65 | + |
| 66 | +### PR Title Convention |
| 67 | + |
| 68 | +Use the following commit/PR title types: |
| 69 | + |
| 70 | +| Type | Description | |
| 71 | +| ---------- | ---------------------------------------------------------------------------- | |
| 72 | +| `feat` | ✨ **New feature** | |
| 73 | +| `fix` | 🐛 **Bug fix** | |
| 74 | +| `chore` | 🔧 Non-code tasks such as updating dependencies, configs, or build tools | |
| 75 | +| `docs` | 📚 Documentation-only changes | |
| 76 | +| `style` | 🎨 Code style changes (formatting, spacing, etc. — without affecting logic) | |
| 77 | +| `refactor` | 🔨 Code refactoring without adding features or fixing bugs | |
| 78 | +| `test` | ✅ Adding or modifying tests (unit tests, integration tests, etc.) | |
| 79 | +| `perf` | 🚀 Performance improvements | |
| 80 | +| `ci` | ⚙️ Changes to CI/CD configuration or pipelines | |
| 81 | +| `build` | 📦 Changes to the build system or external dependencies (e.g., Dockerfile) | |
| 82 | +| `revert` | ⏪ Reverting a previous commit | |
| 83 | +| `code` | General code changes that support but are not core features (e.g., examples) | |
| 84 | + |
| 85 | +### Examples |
| 86 | +- `feat: add Media service auto path detection` |
| 87 | +- `fix: handle empty response in GetServices` |
| 88 | +- `chore: update dependencies` |
| 89 | + |
| 90 | +### General Guidelines |
| 91 | + |
| 92 | +- **Describe your changes clearly** in the PR description. |
| 93 | +- **Reference related issues** by number (e.g., `Fixes #123`). |
| 94 | +- **Keep changes focused**—avoid mixing unrelated fixes or features in one PR. |
| 95 | +- **Include tests** for new features or bug fixes when possible. |
| 96 | +- **Follow the style guide** and ensure your code passes linting and tests. |
| 97 | +- **Be responsive to review feedback** and update your PR as needed. |
| 98 | +- **Squash commits** if requested, to keep history clean. |
| 99 | + |
| 100 | +## Reporting Issues |
| 101 | + |
| 102 | +- Search existing issues before opening a new one to avoid duplicates. |
| 103 | +- Provide as much detail as possible: environment, device model, ONVIF version, error messages, and steps to reproduce. |
| 104 | +- Attach logs, screenshots, or code snippets if relevant. |
| 105 | +- Be polite and constructive—remember, maintainers and contributors are volunteers. |
| 106 | + |
| 107 | +## Style Guide |
| 108 | + |
| 109 | +- **PEP8** is the standard for Python code style. Use tools like `flake8` and `black` to check and format your code. |
| 110 | +- **Docstrings:** Use clear, concise docstrings for modules, classes, and functions. |
| 111 | +- **Type hints:** Add type annotations where appropriate for better readability and tooling support. |
| 112 | +- **Comments:** Write helpful comments, especially for complex logic. |
| 113 | +- **Naming:** Use descriptive variable, function, and class names. |
| 114 | + |
| 115 | +## Documentation |
| 116 | + |
| 117 | +- Update the README if your changes affect usage or installation. |
| 118 | +- Add or update docstrings and inline comments. |
| 119 | +- If you add new modules or services, document their usage and API. |
| 120 | +- For device-specific notes, contribute to the [device-test](https://github.com/nirsimetri/onvif-products/blob/main/device-test) list. |
| 121 | + |
| 122 | +## Community & Support |
| 123 | + |
| 124 | +- Join discussions in the [GitHub Discussions](https://github.com/nirsimetri/onvif-python/discussions) tab. |
| 125 | +- For real-time help, check if there is a chat or forum linked in the repository. |
| 126 | +- Be respectful, patient, and helpful to others. |
| 127 | + |
| 128 | +## License |
| 129 | + |
| 130 | +By contributing, you agree that your contributions will be licensed under the [MIT License](./LICENSE.md). |
| 131 | + |
| 132 | +--- |
| 133 | + |
| 134 | +Thank you for making ONVIF Python better! We appreciate your time, expertise, and enthusiasm. Happy coding! |
0 commit comments