Skip to content

Commit 3ecd924

Browse files
authored
Add codespell support (config, workflow to detect/not fix) and make it fix few typos (#757)
1 parent 6255a87 commit 3ecd924

File tree

7 files changed

+22
-6
lines changed

7 files changed

+22
-6
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,11 @@ repos:
3939
language: system
4040
types: [python]
4141
pass_filenames: false
42+
43+
- repo: https://github.com/codespell-project/codespell
44+
# Configuration for codespell is in pyproject.toml
45+
rev: v2.3.0
46+
hooks:
47+
- id: codespell
48+
additional_dependencies:
49+
- tomli

docs/graph.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -450,7 +450,7 @@ class Feedback(BaseNode[State, None, Email]):
450450
async def main():
451451
user = User(
452452
name='John Doe',
453-
email='john.joe@exmaple.com',
453+
email='john.joe@example.com',
454454
interests=['Haskel', 'Lisp', 'Fortran'],
455455
)
456456
state = State(user)

docs/tools.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ sequenceDiagram
186186

187187
## Registering Function Tools via kwarg
188188

189-
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.
189+
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.
190190

191191
```python {title="dice_game_tool_kwarg.py"}
192192
import random

pydantic_ai_slim/pydantic_ai/models/mistral.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ def _map_content(content: MistralOptionalNullable[MistralContent]) -> str | None
600600
elif isinstance(content, str):
601601
result = content
602602

603-
# 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`)
603+
# 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`)
604604
if result and len(result) == 0:
605605
result = None
606606

pydantic_ai_slim/pydantic_ai/models/ollama.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
):
8181
"""Initialize an Ollama model.
8282
83-
Ollama has built-in compatability for the OpenAI chat completions API ([source](https://ollama.com/blog/openai-compatibility)), so we reuse the
83+
Ollama has built-in compatibility for the OpenAI chat completions API ([source](https://ollama.com/blog/openai-compatibility)), so we reuse the
8484
[`OpenAIModel`][pydantic_ai.models.openai.OpenAIModel] here.
8585
8686
Args:

pyproject.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,3 +183,11 @@ ignore_no_config = true
183183
[tool.inline-snapshot.shortcuts]
184184
snap-fix=["create", "fix"]
185185
snap=["create"]
186+
187+
[tool.codespell]
188+
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
189+
skip = '.git*,*.svg,*.lock,*.css'
190+
check-hidden = true
191+
# Ignore "formatting" like **L**anguage
192+
ignore-regex = '\*\*[A-Z]\*\*[a-z]+\b'
193+
# ignore-words-list = ''

tests/typed_graph.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,6 @@ def run_g5() -> None:
109109
g5.run_sync(A()) # pyright: ignore[reportArgumentType]
110110
g5.run_sync(A(), state=MyState(x=1)) # pyright: ignore[reportArgumentType]
111111
g5.run_sync(A(), deps=MyDeps(y='y')) # pyright: ignore[reportArgumentType]
112-
ans, history = g5.run_sync(A(), state=MyState(x=1), deps=MyDeps(y='y'))
113-
assert_type(ans, int)
112+
answer, history = g5.run_sync(A(), state=MyState(x=1), deps=MyDeps(y='y'))
113+
assert_type(answer, int)
114114
assert_type(history, list[HistoryStep[MyState, int]])

0 commit comments

Comments
 (0)