|
| 1 | +# stripe-python |
| 2 | + |
| 3 | +## Testing |
| 4 | + |
| 5 | +- Run all tests: `just test` |
| 6 | +- Run a specific test by name: `just test-one test_name` |
| 7 | +- Run a specific test file: `just test tests/path/to/test_file.py` |
| 8 | + |
| 9 | +## Formatting & Linting |
| 10 | + |
| 11 | +- Format: `just format` (uses ruff) |
| 12 | +- Lint: `just lint` (uses flake8) |
| 13 | +- Typecheck: `just typecheck` (uses pyright) |
| 14 | + |
| 15 | +## Key Locations |
| 16 | + |
| 17 | +- HTTP client (request execution, retries, headers): `stripe/_http_client.py` |
| 18 | +- Main client class: `stripe/_stripe_client.py` |
| 19 | +- Client options/config: `stripe/_client_options.py` |
| 20 | +- API requestor (request building, auth): `stripe/_api_requestor.py` |
| 21 | + |
| 22 | +## Generated Code |
| 23 | + |
| 24 | +- Files containing `File generated from our OpenAPI spec` at the top are generated; do not edit. Similarly, any code block starting with `The beginning of the section generated from our OpenAPI spec` is generated and should not be edited directly. |
| 25 | + - If something in a generated file/range needs to be updated, add a summary of the change to your report but don't attempt to edit it directly. |
| 26 | +- Most files under `stripe/` resource subdirectories (e.g. `stripe/_customer.py`, `stripe/params/`, `stripe/resources/`) are generated. |
| 27 | +- The HTTP client layer (`_http_client.py`, `_stripe_client.py`, `_api_requestor.py`, `_client_options.py`) is NOT generated. |
| 28 | + |
| 29 | +## Conventions |
| 30 | + |
| 31 | +- Uses `requests` library by default for sync HTTP, `httpx` for async |
| 32 | +- Type hints throughout |
| 33 | +- Virtual env managed in `.venv/`; `just` recipes handle setup automatically |
| 34 | +- Work is not complete until `just test`, `just lint` and `just typecheck` complete successfully. |
| 35 | +- All code must run on all supported Python versions (full list in the test section of @.github/workflows/ci.yml) |
| 36 | + |
| 37 | +### Comments |
| 38 | + |
| 39 | +- Comments MUST only be used to: |
| 40 | + 1. Document a function |
| 41 | + 2. Explain the WHY of a piece of code |
| 42 | + 3. Explain a particularly complicated piece of code |
| 43 | +- Comments NEVER should be used to: |
| 44 | + 1. Say what used to be there. That's no longer relevant! |
| 45 | + 2. Explain the WHAT of a piece of code (unless it's very non-obvious) |
| 46 | + |
| 47 | +It's ok not to put comments on/in a function if their addition wouldn't meaningfully clarify anything. |
0 commit comments