|
| 1 | +# Contributing to Hyperbrowser Python SDK |
| 2 | + |
| 3 | +Thanks for contributing! This guide keeps local development and CI behavior aligned. |
| 4 | + |
| 5 | +## Prerequisites |
| 6 | + |
| 7 | +- Python `>=3.9` |
| 8 | +- `pip` |
| 9 | + |
| 10 | +## Local setup |
| 11 | + |
| 12 | +```bash |
| 13 | +python -m pip install -e . pytest ruff build |
| 14 | +``` |
| 15 | + |
| 16 | +Or with Make: |
| 17 | + |
| 18 | +```bash |
| 19 | +make install |
| 20 | +``` |
| 21 | + |
| 22 | +## Development workflow |
| 23 | + |
| 24 | +1. Create a focused branch. |
| 25 | +2. Make a single logical change. |
| 26 | +3. Run relevant tests first (targeted), then full checks before opening a PR. |
| 27 | +4. Keep commits small and descriptive. |
| 28 | + |
| 29 | +## Commands |
| 30 | + |
| 31 | +### Linting and formatting |
| 32 | + |
| 33 | +```bash |
| 34 | +python -m ruff check . |
| 35 | +python -m ruff format --check . |
| 36 | +``` |
| 37 | + |
| 38 | +Or: |
| 39 | + |
| 40 | +```bash |
| 41 | +make lint |
| 42 | +make format-check |
| 43 | +``` |
| 44 | + |
| 45 | +### Tests |
| 46 | + |
| 47 | +```bash |
| 48 | +python -m pytest -q |
| 49 | +``` |
| 50 | + |
| 51 | +Or: |
| 52 | + |
| 53 | +```bash |
| 54 | +make test |
| 55 | +``` |
| 56 | + |
| 57 | +### Full local CI parity |
| 58 | + |
| 59 | +```bash |
| 60 | +make ci |
| 61 | +``` |
| 62 | + |
| 63 | +This runs lint, format checks, compile checks, tests, and package build. |
| 64 | + |
| 65 | +## Testing guidance |
| 66 | + |
| 67 | +- Add tests for any bug fix or behavior change. |
| 68 | +- Keep sync/async behavior in parity where applicable. |
| 69 | +- Prefer deterministic unit tests over network-dependent tests. |
| 70 | + |
| 71 | +## Code quality conventions |
| 72 | + |
| 73 | +- Prefer explicit error messages with `HyperbrowserError`. |
| 74 | +- Preserve `original_error` for wrapped runtime failures. |
| 75 | +- Avoid mutating user-provided input payloads. |
| 76 | +- Keep sync and async manager APIs aligned. |
| 77 | + |
| 78 | +## Pull request checklist |
| 79 | + |
| 80 | +- [ ] Lint and format checks pass. |
| 81 | +- [ ] Tests pass locally. |
| 82 | +- [ ] New behavior is covered by tests. |
| 83 | +- [ ] Public API changes are documented in `README.md` (if applicable). |
0 commit comments