|
1 | 1 | # Contributing to PyCDP |
2 | 2 |
|
3 | | -Thank you for your interest in contributing to Python Chrome DevTools Protocol (PyCDP)! This document provides guidelines for contributing to the project. |
| 3 | +Thank you for your interest in contributing to Python Chrome DevTools Protocol (PyCDP)! We welcome contributions from the community. |
4 | 4 |
|
5 | 5 | ## Getting Started |
6 | 6 |
|
7 | 7 | ### Prerequisites |
8 | 8 |
|
9 | 9 | - Python 3.7 or higher |
10 | | -- [Poetry](https://python-poetry.org/) for dependency management |
| 10 | +- Poetry for dependency management |
| 11 | +- Git for version control |
11 | 12 |
|
12 | | -### Setting Up Your Development Environment |
| 13 | +### Setting Up Development Environment |
13 | 14 |
|
14 | | -1. Fork the repository on GitHub |
15 | | -2. Clone your fork locally: |
| 15 | +1. Fork and clone the repository: |
16 | 16 | ```bash |
17 | 17 | git clone https://github.com/YOUR_USERNAME/python-chrome-devtools-protocol.git |
18 | 18 | cd python-chrome-devtools-protocol |
19 | 19 | ``` |
20 | | -3. Install dependencies: |
| 20 | + |
| 21 | +2. Install dependencies: |
21 | 22 | ```bash |
| 23 | + pip install poetry |
22 | 24 | poetry install |
23 | 25 | ``` |
24 | 26 |
|
25 | 27 | ## Development Workflow |
26 | 28 |
|
27 | 29 | ### Code Generation |
28 | 30 |
|
29 | | -This project automatically generates Python wrappers from the Chrome DevTools Protocol specification. Most code in the `cdp/` directory (except `connection.py` and `util.py`) is auto-generated. |
| 31 | +This project automatically generates Python wrappers from the Chrome DevTools Protocol specification: |
30 | 32 |
|
31 | | -To regenerate the protocol wrappers: |
32 | 33 | ```bash |
33 | | -poetry run make generate |
| 34 | +poetry run python generator/generate.py |
34 | 35 | ``` |
35 | 36 |
|
36 | 37 | ### Running Tests |
37 | 38 |
|
38 | 39 | Run the test suite: |
39 | 40 | ```bash |
40 | | -poetry run make test-cdp |
41 | | -poetry run make test-generate |
42 | | -``` |
43 | | - |
44 | | -Or run all checks: |
45 | | -```bash |
46 | | -poetry run make |
| 41 | +poetry run pytest test/ |
| 42 | +poetry run pytest generator/ |
47 | 43 | ``` |
48 | 44 |
|
49 | 45 | ### Type Checking |
50 | 46 |
|
51 | 47 | We use mypy for static type checking: |
52 | 48 | ```bash |
53 | | -poetry run make mypy-cdp |
54 | | -poetry run make mypy-generate |
| 49 | +poetry run mypy cdp/ |
| 50 | +poetry run mypy generator/ |
55 | 51 | ``` |
56 | 52 |
|
57 | | -### Building Documentation |
| 53 | +### Complete Build |
58 | 54 |
|
59 | | -To build the documentation: |
| 55 | +Run all checks (type checking, tests, and generation): |
60 | 56 | ```bash |
61 | | -poetry run make docs |
| 57 | +poetry run make default |
62 | 58 | ``` |
63 | 59 |
|
64 | | -## Making Changes |
65 | | - |
66 | | -### Code Style |
| 60 | +## Submitting Changes |
67 | 61 |
|
68 | | -- Follow PEP 8 style guidelines |
69 | | -- Use type hints for all function signatures |
70 | | -- Keep code clear and well-documented |
71 | | - |
72 | | -### Commit Messages |
73 | | - |
74 | | -- Use clear and descriptive commit messages |
75 | | -- Reference issue numbers when applicable |
76 | | -- Keep commits focused on a single change |
| 62 | +### Pull Request Process |
77 | 63 |
|
78 | | -### Pull Requests |
79 | | - |
80 | | -1. Create a new branch for your changes: |
| 64 | +1. Create a new branch for your feature or bugfix: |
81 | 65 | ```bash |
82 | 66 | git checkout -b feature/your-feature-name |
83 | 67 | ``` |
84 | | -2. Make your changes and commit them |
85 | | -3. Push to your fork and submit a pull request |
86 | | -4. Ensure all tests pass and type checking succeeds |
87 | | -5. Provide a clear description of your changes |
88 | | - |
89 | | -## What to Contribute |
90 | 68 |
|
91 | | -### Areas for Contribution |
| 69 | +2. Make your changes and ensure: |
| 70 | + - All tests pass |
| 71 | + - Code passes type checking |
| 72 | + - Code follows the existing style |
| 73 | + - Documentation is updated if needed |
92 | 74 |
|
93 | | -- **Bug fixes**: Fix issues in the connection module or utility functions |
94 | | -- **Documentation**: Improve examples, tutorials, or API documentation |
95 | | -- **Tests**: Add test coverage for existing functionality |
96 | | -- **Examples**: Add new usage examples in the `examples/` directory |
| 75 | +3. Commit your changes with clear, descriptive messages: |
| 76 | + ```bash |
| 77 | + git commit -m "Add feature: brief description" |
| 78 | + ``` |
97 | 79 |
|
98 | | -### Code Generation Changes |
| 80 | +4. Push to your fork and submit a pull request: |
| 81 | + ```bash |
| 82 | + git push origin feature/your-feature-name |
| 83 | + ``` |
99 | 84 |
|
100 | | -If you need to modify code generation: |
101 | | -- Edit files in the `generator/` directory |
102 | | -- Run the generator and verify the output |
103 | | -- Ensure all tests still pass |
104 | | -- Add tests for your generator changes |
| 85 | +5. In your pull request description: |
| 86 | + - Describe what changes you made and why |
| 87 | + - Reference any related issues |
| 88 | + - Include any relevant context |
105 | 89 |
|
106 | | -### Protocol Updates |
| 90 | +### Code Review |
107 | 91 |
|
108 | | -The protocol definitions are automatically fetched from the Chrome DevTools Protocol repository. If you need to update to a newer protocol version, please open an issue first to discuss the change. |
| 92 | +- Maintainers will review your pull request |
| 93 | +- Address any feedback or requested changes |
| 94 | +- Once approved, a maintainer will merge your PR |
109 | 95 |
|
110 | 96 | ## Reporting Issues |
111 | 97 |
|
112 | 98 | ### Bug Reports |
113 | 99 |
|
114 | 100 | When reporting bugs, please include: |
115 | | -- Python version |
116 | | -- PyCDP version |
117 | | -- Steps to reproduce |
118 | | -- Expected vs. actual behavior |
119 | | -- Error messages or stack traces |
| 101 | +- A clear, descriptive title |
| 102 | +- Steps to reproduce the issue |
| 103 | +- Expected behavior vs. actual behavior |
| 104 | +- Python version and environment details |
| 105 | +- Any relevant error messages or logs |
120 | 106 |
|
121 | 107 | ### Feature Requests |
122 | 108 |
|
123 | | -For feature requests: |
124 | | -- Clearly describe the feature |
125 | | -- Explain the use case |
126 | | -- Consider if it fits the project's scope |
| 109 | +For feature requests, please: |
| 110 | +- Clearly describe the feature and its use case |
| 111 | +- Explain why it would be valuable |
| 112 | +- Provide examples if possible |
127 | 113 |
|
128 | | -## Code of Conduct |
| 114 | +## Code Style |
129 | 115 |
|
130 | | -Please be respectful and constructive in all interactions. We are committed to providing a welcoming and inclusive environment for all contributors. |
| 116 | +- Follow PEP 8 style guidelines |
| 117 | +- Use type hints for function parameters and return values |
| 118 | +- Write clear, descriptive variable and function names |
| 119 | +- Add docstrings for public APIs |
| 120 | +- Keep functions focused and modular |
131 | 121 |
|
132 | | -## Questions? |
| 122 | +## Documentation |
133 | 123 |
|
134 | | -If you have questions about contributing, please: |
135 | | -- Check existing issues and pull requests |
136 | | -- Open a new issue with your question |
137 | | -- Tag it appropriately for visibility |
| 124 | +- Update README.md if you add new features |
| 125 | +- Update docstrings for any modified functions or classes |
| 126 | +- Add examples for new functionality when appropriate |
138 | 127 |
|
139 | 128 | ## License |
140 | 129 |
|
141 | | -By contributing to PyCDP, you agree that your contributions will be licensed under the MIT License. |
| 130 | +By contributing, you agree that your contributions will be licensed under the MIT License. |
| 131 | + |
| 132 | +## Questions? |
| 133 | + |
| 134 | +If you have questions, feel free to: |
| 135 | +- Open an issue for discussion |
| 136 | +- Reach out to the maintainers |
142 | 137 |
|
143 | 138 | Thank you for contributing to PyCDP! |
0 commit comments