Skip to content

Commit ed158e5

Browse files
authored
Merge branch 'main' into features/elicitation-callback
2 parents a7bc91a + a6761cb commit ed158e5

34 files changed

+1146
-320
lines changed

.claude/settings.json

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"permissions": {
3+
"allow": [
4+
"Bash(rg:*)",
5+
"Bash(make:*)",
6+
"Bash(uv run pytest:*)",
7+
"Bash(uv run:*)",
8+
"Bash(git push:*)",
9+
"Bash(git checkout:*)",
10+
"Bash(gh pr create:*)",
11+
"Bash(gh pr view:*)",
12+
"Bash(git add:*)",
13+
"Bash(git commit:*)",
14+
"Bash(gh pr comment:*)",
15+
"Bash(gh pr checks:*)",
16+
"Bash(gh run view:*)",
17+
"Bash(gh pr list:*)",
18+
"Bash(gh api:*)",
19+
"Bash(pre-commit run:*)",
20+
"Bash(grep:*)",
21+
"Bash(find:*)",
22+
"Bash(coverage:*)"
23+
],
24+
"deny": []
25+
}
26+
}

.github/workflows/ci.yml

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,20 @@ jobs:
131131
CO_API_KEY: ${{ secrets.COHERE_API_KEY }}
132132
133133
test:
134-
name: test on ${{ matrix.python-version }} (${{ matrix.install }})
134+
name: test on ${{ matrix.python-version }} (${{ matrix.install.name }})
135135
runs-on: ubuntu-latest
136136
timeout-minutes: 10
137137
strategy:
138138
fail-fast: false
139139
matrix:
140140
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
141-
install: ["slim", "standard", "all-extras"]
141+
install:
142+
- name: pydantic-ai-slim
143+
command: "--package pydantic-ai-slim"
144+
- name: standard
145+
command: ""
146+
- name: all-extras
147+
command: "--all-extras"
142148
env:
143149
UV_PYTHON: ${{ matrix.python-version }}
144150
CI: true
@@ -154,29 +160,18 @@ jobs:
154160
with:
155161
deno-version: v2.x
156162

157-
- name: choose install command
158-
run: |
159-
if [ "${{ matrix.install }}" = "slim" ]; then
160-
echo "install-command=--package pydantic-ai-slim" >> $GITHUB_OUTPUT
161-
elif [ "${{ matrix.install }}" = "standard" ]; then
162-
echo "install-command=" >> $GITHUB_OUTPUT
163-
elif [ "${{ matrix.install }}" = "all-extras" ]; then
164-
echo "install-command=--all-extras" >> $GITHUB_OUTPUT
165-
fi
166-
id: install-command
167-
168163
- run: mkdir .coverage
169164

170-
- run: uv sync --group dev
171-
- run: uv run ${{ steps.install-command.outputs.install-command }} coverage run -m pytest -n auto --dist=loadgroup
165+
- run: uv sync --only-dev
166+
- run: uv run ${{ matrix.install.command }} coverage run -m pytest --durations=100 -n auto --dist=loadgroup
172167
env:
173-
COVERAGE_FILE: .coverage/.coverage.${{ matrix.python-version }}-${{ matrix.install }}
168+
COVERAGE_FILE: .coverage/.coverage.${{ matrix.python-version }}-${{ matrix.install.name }}
174169

175170
- name: store coverage files
176171
uses: actions/upload-artifact@v4
177172
if: matrix.python-version != '3.9'
178173
with:
179-
name: coverage-${{ matrix.python-version }}-${{ matrix.install }}
174+
name: coverage-${{ matrix.python-version }}-${{ matrix.install.name }}
180175
path: .coverage
181176
include-hidden-files: true
182177

@@ -209,7 +204,7 @@ jobs:
209204

210205
- run: unset UV_FROZEN
211206

212-
- run: uv run --all-extras --resolution lowest-direct coverage run -m pytest -n auto --dist=loadgroup
207+
- run: uv run --all-extras --resolution lowest-direct coverage run -m pytest --durations=100 -n auto --dist=loadgroup
213208
env:
214209
COVERAGE_FILE: .coverage/.coverage.${{matrix.python-version}}-lowest-versions
215210

.hyperlint/config.yaml

Lines changed: 0 additions & 3 deletions
This file was deleted.

CLAUDE.md

Lines changed: 44 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,18 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
55
## Development Commands
66

77
### Core Development Tasks
8+
89
- **Install dependencies**: `make install` (requires uv, pre-commit, and deno)
9-
- **Run all checks**: `make` (format, lint, typecheck, test with coverage)
10-
- **Format code**: `make format`
11-
- **Lint code**: `make lint`
12-
- **Type checking**: `make typecheck` (uses pyright) or `make typecheck-both` (pyright + mypy)
13-
- **Run tests**: `make test` (with coverage)
10+
- **Run all checks**: `pre-commit run --all-files`
11+
- **Run tests**: `make test`
1412
- **Build docs**: `make docs` or `make docs-serve` (local development)
1513

1614
### Single Test Commands
15+
1716
- **Run specific test**: `uv run pytest tests/test_agent.py::test_function_name -v`
1817
- **Run test file**: `uv run pytest tests/test_agent.py -v`
1918
- **Run with debug**: `uv run pytest tests/test_agent.py -v -s`
2019

21-
### Multi-Python Testing
22-
- **Install all Python versions**: `make install-all-python`
23-
- **Test all Python versions**: `make test-all-python`
24-
2520
## Project Architecture
2621

2722
### Core Components
@@ -125,3 +120,43 @@ This is a uv workspace with multiple packages:
125120
- **Lock file**: `uv.lock` (commit this file)
126121
- **Sync command**: `make sync` to update dependencies
127122
- **Optional extras**: Define groups in `pyproject.toml` optional-dependencies
123+
124+
## Best Practices
125+
126+
This is the list of best practices for working with the codebase.
127+
128+
### Rename a class
129+
130+
When asked to rename a class, you need to rename the class in the code and add a deprecation warning to the old class.
131+
132+
```python
133+
from typing_extensions import deprecated
134+
135+
class NewClass: ... # This class was renamed from OldClass.
136+
137+
@deprecated("Use `NewClass` instead")
138+
class OldClass(NewClass): ...
139+
```
140+
141+
In the test suite, you MUST use the `NewClass` instead of the `OldClass`, and create a new test to verify the
142+
deprecation warning:
143+
144+
```python
145+
def test_old_class_is_deprecated():
146+
with pytest.warns(DeprecationWarning, match="Use `NewClass` instead"):
147+
OldClass()
148+
```
149+
150+
In the documentation, you should not have references to the old class, only the new class.
151+
152+
### Writing documentation
153+
154+
Always reference Python objects with the "`" (backticks) around them, and link to the API reference, for example:
155+
156+
```markdown
157+
The [`Agent`][pydantic_ai.agent.Agent] class is the main entry point for creating and running agents.
158+
```
159+
160+
### Coverage
161+
162+
Every pull request MUST have 100% coverage. You can check the coverage by running `make test`.

docs/logfire.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@ The following providers have dedicated documentation on Pydantic AI:
255255
- [Opik](https://www.comet.com/docs/opik/tracing/integrations/pydantic-ai)
256256
- [mlflow](https://mlflow.org/docs/latest/genai/tracing/integrations/listing/pydantic_ai)
257257
- [Agenta](https://docs.agenta.ai/observability/integrations/pydanticai)
258+
- [Confident AI](https://documentation.confident-ai.com/docs/llm-tracing/integrations/pydanticai)
258259

259260
## Advanced usage
260261

0 commit comments

Comments
 (0)