From 36c0376eaad4cba23eeead8f752dc965d33cea42 Mon Sep 17 00:00:00 2001 From: Amish Regmi Date: Sun, 17 May 2026 21:36:19 -0400 Subject: [PATCH 1/2] docs(readme): use markdown link for examples/hooks.py reference --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 8d8445238..84a4fbcbc 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ options = ClaudeAgentOptions( A **hook** is a Python function that the Claude Code _application_ (_not_ Claude) invokes at specific points of the Claude agent loop. Hooks can provide deterministic processing and automated feedback for Claude. Read more in [Intercept and control agent behavior with hooks](https://platform.claude.com/docs/en/agent-sdk/hooks). -For more examples, see examples/hooks.py. +For more examples, see [examples/hooks.py](examples/hooks.py). #### Example From 32a9289eed2898430e30617290ab3f33b8bd3cdb Mon Sep 17 00:00:00 2001 From: Amish Regmi Date: Wed, 20 May 2026 18:43:10 -0400 Subject: [PATCH 2/2] docs(readme): document dev setup, local checks, and PR conventions Expands the Development section with the dev-deps install (pip install -e ".[dev]"), the manual ruff/mypy/pytest commands documented in CLAUDE.md, and the Conventional Commits PR title convention used by recent merged PRs. Addresses #966 by consolidating the workflow information where human contributors will find it. --- README.md | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 84a4fbcbc..552635106 100644 --- a/README.md +++ b/README.md @@ -289,13 +289,46 @@ If you're upgrading from the Claude Code SDK (versions < 0.1.0), please see the ## Development -If you're contributing to this project, run the initial setup script to install git hooks: +### Setting up a development environment + +Install the SDK in editable mode along with the dev dependencies (`pytest`, `pytest-asyncio`, `pytest-cov`, `mypy`, `ruff`): + +```bash +pip install -e ".[dev]" +``` + +Then install the pre-push git hook so lint checks run before each push (matching CI): ```bash ./scripts/initial-setup.sh ``` -This installs a pre-push hook that runs lint checks before pushing, matching the CI workflow. To skip the hook temporarily, use `git push --no-verify`. +To skip the hook for a single push, use `git push --no-verify`. + +### Running checks locally + +The pre-push hook wraps the same commands you can run directly: + +```bash +# Lint and auto-fix +python -m ruff check src/ tests/ --fix + +# Format +python -m ruff format src/ tests/ + +# Type-check +python -m mypy src/ + +# Tests (all) +python -m pytest tests/ + +# Tests (single file) +python -m pytest tests/test_client.py +``` + +### Pull request conventions + +PR titles follow [Conventional Commits](https://www.conventionalcommits.org/), e.g. `fix(transport): handle CancelledError`, `docs: update changelog`, `feat(hooks): add SubagentStartHookInput`. Recent merged PRs are good references for tone and scope. ### Building Wheels Locally