From b0ab6d8b75b9f51a47f4263660793e97886358ca Mon Sep 17 00:00:00 2001 From: Weizhou Xing <169175349+wzxxing@users.noreply.github.com> Date: Mon, 19 May 2025 11:11:52 +0200 Subject: [PATCH] docs: update contributing guide to manage python env with hatch shell --- CONTRIBUTING.md | 8 +++++++- pyproject.toml | 5 +++++ src/strands/handlers/tool_handler.py | 1 + 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b50957ef..9ca462bf 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -31,11 +31,17 @@ This project uses [hatchling](https://hatch.pypa.io/latest/build/#hatchling) as ### Setting Up Your Development Environment -1. Install development dependencies: +1. Entering virtual environment using `hatch` (recommended), then launch your IDE in the new shell. + ```bash + hatch shell dev + ``` + + Alternatively, install development dependencies in a manually created virtual environment: ```bash pip install -e ".[dev]" && pip install -e ".[litellm] ``` + 2. Set up pre-commit hooks: ```bash pre-commit install -t pre-commit -t commit-msg diff --git a/pyproject.toml b/pyproject.toml index 43130ac9..b50f0431 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -114,6 +114,11 @@ extra-args = [ "-vv", ] +[tool.hatch.envs.dev] +dev-mode = true +features = ["dev", "docs", "anthropic", "litellm", "llamaapi", "ollama"] + + [[tool.hatch.envs.hatch-test.matrix]] python = ["3.13", "3.12", "3.11", "3.10"] diff --git a/src/strands/handlers/tool_handler.py b/src/strands/handlers/tool_handler.py index 0803eca5..bc4ec1ce 100644 --- a/src/strands/handlers/tool_handler.py +++ b/src/strands/handlers/tool_handler.py @@ -46,6 +46,7 @@ def preprocess( def process( self, tool: Any, + *, model: Model, system_prompt: Optional[str], messages: List[Any],