diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 714e9156f7..e990a04963 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -39,3 +39,11 @@ repos: language: system types: [python] pass_filenames: false + + - repo: https://github.com/codespell-project/codespell + # Configuration for codespell is in pyproject.toml + rev: v2.3.0 + hooks: + - id: codespell + additional_dependencies: + - tomli diff --git a/docs/graph.md b/docs/graph.md index d231f6ca3b..74aa4eaf23 100644 --- a/docs/graph.md +++ b/docs/graph.md @@ -450,7 +450,7 @@ class Feedback(BaseNode[State, None, Email]): async def main(): user = User( name='John Doe', - email='john.joe@exmaple.com', + email='john.joe@example.com', interests=['Haskel', 'Lisp', 'Fortran'], ) state = State(user) diff --git a/docs/tools.md b/docs/tools.md index a966a996bd..0f03a07bb2 100644 --- a/docs/tools.md +++ b/docs/tools.md @@ -186,7 +186,7 @@ sequenceDiagram ## Registering Function Tools via kwarg -As well as using the decorators, we can register tools via the `tools` argument to the [`Agent` constructor][pydantic_ai.Agent.__init__]. This is useful when you want to re-use tools, and can also give more fine-grained control over the tools. +As well as using the decorators, we can register tools via the `tools` argument to the [`Agent` constructor][pydantic_ai.Agent.__init__]. This is useful when you want to reuse tools, and can also give more fine-grained control over the tools. ```python {title="dice_game_tool_kwarg.py"} import random diff --git a/pydantic_ai_slim/pydantic_ai/models/mistral.py b/pydantic_ai_slim/pydantic_ai/models/mistral.py index 2968ed4e38..90101e0676 100644 --- a/pydantic_ai_slim/pydantic_ai/models/mistral.py +++ b/pydantic_ai_slim/pydantic_ai/models/mistral.py @@ -600,7 +600,7 @@ def _map_content(content: MistralOptionalNullable[MistralContent]) -> str | None elif isinstance(content, str): result = content - # Note: Check len to handle potential mismatch between function calls and responses from the API. (`msg: not the same number of function class and reponses`) + # Note: Check len to handle potential mismatch between function calls and responses from the API. (`msg: not the same number of function class and responses`) if result and len(result) == 0: result = None diff --git a/pydantic_ai_slim/pydantic_ai/models/ollama.py b/pydantic_ai_slim/pydantic_ai/models/ollama.py index 6e167317b8..ae38201676 100644 --- a/pydantic_ai_slim/pydantic_ai/models/ollama.py +++ b/pydantic_ai_slim/pydantic_ai/models/ollama.py @@ -80,7 +80,7 @@ def __init__( ): """Initialize an Ollama model. - Ollama has built-in compatability for the OpenAI chat completions API ([source](https://ollama.com/blog/openai-compatibility)), so we reuse the + Ollama has built-in compatibility for the OpenAI chat completions API ([source](https://ollama.com/blog/openai-compatibility)), so we reuse the [`OpenAIModel`][pydantic_ai.models.openai.OpenAIModel] here. Args: diff --git a/pyproject.toml b/pyproject.toml index fdc613b039..1141cdf776 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -183,3 +183,11 @@ ignore_no_config = true [tool.inline-snapshot.shortcuts] snap-fix=["create", "fix"] snap=["create"] + +[tool.codespell] +# Ref: https://github.com/codespell-project/codespell#using-a-config-file +skip = '.git*,*.svg,*.lock,*.css' +check-hidden = true +# Ignore "formatting" like **L**anguage +ignore-regex = '\*\*[A-Z]\*\*[a-z]+\b' +# ignore-words-list = '' diff --git a/tests/typed_graph.py b/tests/typed_graph.py index 06ef0b6a55..d0b6a02b7e 100644 --- a/tests/typed_graph.py +++ b/tests/typed_graph.py @@ -109,6 +109,6 @@ def run_g5() -> None: g5.run_sync(A()) # pyright: ignore[reportArgumentType] g5.run_sync(A(), state=MyState(x=1)) # pyright: ignore[reportArgumentType] g5.run_sync(A(), deps=MyDeps(y='y')) # pyright: ignore[reportArgumentType] - ans, history = g5.run_sync(A(), state=MyState(x=1), deps=MyDeps(y='y')) - assert_type(ans, int) + answer, history = g5.run_sync(A(), state=MyState(x=1), deps=MyDeps(y='y')) + assert_type(answer, int) assert_type(history, list[HistoryStep[MyState, int]])