|
2 | 2 |
|
3 | 3 | ## Development setup |
4 | 4 |
|
5 | | -Use Python 3.9 or newer. Create and activate a virtual environment, then |
6 | | -install the package with its development and test dependencies: |
| 5 | +Use Python 3.10 or newer and install [uv](https://docs.astral.sh/uv/). From the |
| 6 | +repository root, install the locked development and test dependencies: |
7 | 7 |
|
8 | 8 | ```bash |
9 | | -python -m venv .venv |
10 | | -source .venv/bin/activate |
11 | | -python -m pip install -e ".[dev,test]" |
| 9 | +uv sync --locked --extra dev --extra test |
| 10 | +make hooks |
12 | 11 | ``` |
13 | 12 |
|
14 | | -Before opening a pull request, run the focused checks for your change. The |
15 | | -complete local check is: |
| 13 | +Before opening a pull request, run: |
16 | 14 |
|
17 | 15 | ```bash |
18 | | -python -m pytest |
19 | | -hatch build |
20 | | -python -m twine check dist/* |
| 16 | +make lint |
| 17 | +make test |
| 18 | +uv run --locked hatch build |
| 19 | +uv run --locked python -m twine check dist/* |
21 | 20 | ``` |
22 | 21 |
|
| 22 | +## Linting and formatting |
| 23 | + |
| 24 | +Ruff checks Python source, tests, hooks, examples, and developer scripts. The |
| 25 | +rule set lives in `pyproject.toml`; CI, Make targets, and pre-commit use the same |
| 26 | +Ruff version from `uv.lock`. |
| 27 | + |
| 28 | +`make lint-fix` applies safe lint fixes. `make format` formats files with a line |
| 29 | +length of 120. Pre-commit applies both to staged Python files. Review and stage |
| 30 | +any edits before committing again. CI checks the full repository on every pull |
| 31 | +request and push to `main`. |
| 32 | + |
| 33 | +Functions are limited to cyclomatic complexity 12 and eight arguments. Existing |
| 34 | +over-limit functions carry explicit suppressions; split new functions that exceed |
| 35 | +the limits. `RUF100` rejects suppressions that become unnecessary. Avoid running |
| 36 | +`ruff check --fix` with a narrow `--select` that includes `RUF100`, because it |
| 37 | +can remove markers for rules outside that selection. |
| 38 | + |
| 39 | +Integration tests requiring live credentials are opt-in; see |
| 40 | +[tests/README.md](tests/README.md). The default `make test` runs unit tests and mocked endpoint tests. |
| 41 | + |
23 | 42 | ## Pull request validation |
24 | 43 |
|
25 | 44 | The `Package Check` workflow runs automatically for pull requests. It runs the |
|
0 commit comments