Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ jobs:
env:
SKIP: no-commit-to-branch

- run: uv build --all-packages
- run: ls -lh dist/

# mypy and lint are a bit slower than other jobs, so we run them separately
mypy:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -193,7 +196,7 @@ jobs:
with:
version_file_path: pyproject.toml

- run: uv build
- run: uv build --all-packages

- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
Expand Down
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

.PHONY: install # Install the package, dependencies, and pre-commit for local development
install: .uv .pre-commit
uv sync --frozen --all-extras --group lint --group docs
uv sync --frozen --all-extras --all-packages --group lint --group docs
pre-commit install --install-hooks

.PHONY: sync # Update local packages and uv.lock
sync: .uv
uv sync --all-extras --group lint --group docs
uv sync --all-extras --all-packages --group lint --group docs

.PHONY: format # Format the code
format:
Expand Down
1 change: 0 additions & 1 deletion docs/.hooks/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ def sub_cf_video(m: re.Match[str]) -> str:

domain = 'https://customer-nmegqx24430okhaq.cloudflarestream.com'
poster = f'{domain}/{video_id}/thumbnails/thumbnail.jpg?time={time}&height=600'
print(poster)
return f"""
<div style="position: relative; padding-top: 67%;">
<iframe
Expand Down
7 changes: 3 additions & 4 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ markdown_extensions:
- sane_lists # this means you can start a list from any number

watch:
- pydantic_ai
- pydantic_ai_slim
- pydantic_ai_examples

plugins:
Expand All @@ -141,7 +141,7 @@ plugins:
- mkdocstrings:
handlers:
python:
paths: [src/packages/pydantic_ai/pydantic_ai]
paths: [src/packages/pydantic_ai_slim/pydantic_ai]
options:
relative_crossrefs: true
members_order: source
Expand All @@ -153,8 +153,7 @@ plugins:
heading_level: 3
import:
- url: https://docs.python.org/3/objects.inv
# TODO use /latest/ not /dev/ when Pydantic 2.10 is released
- url: https://docs.pydantic.dev/dev/objects.inv
- url: https://docs.pydantic.dev/latest/objects.inv
- url: https://fastapi.tiangolo.com/objects.inv
- url: https://typing-extensions.readthedocs.io/en/latest/objects.inv
- url: https://rich.readthedocs.io/en/stable/objects.inv
Expand Down
2 changes: 0 additions & 2 deletions pydantic_ai_examples/.ruff.toml

This file was deleted.

57 changes: 57 additions & 0 deletions pydantic_ai_examples/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "pydantic-ai-examples"
version = "0.0.6a4"
description = "Agent Framework / shim to use Pydantic with LLMs"
authors = [
{ name = "Samuel Colvin", email = "samuel@pydantic.dev" },
]
license = "MIT"
readme = "README.md"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
"Environment :: MacOS X",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
]
requires-python = ">=3.9"
dependencies = [
"pydantic-ai-slim[openai,vertexai,groq]==0.0.6a4",
"asyncpg>=0.30.0",
"fastapi>=0.115.4",
"logfire[asyncpg,fastapi]>=2.3",
"python-multipart>=0.0.17",
"rich>=13.9.2",
"uvicorn>=0.32.0",
]

[tool.hatch.build]
include = ["*.py", "*.html", "*.ts"]

[tool.hatch.build.targets.wheel.sources]
"" = "pydantic_ai_examples"

[tool.uv.sources]
pydantic-ai-slim = { workspace = true }

[tool.ruff]
extend = "../pyproject.toml"
line-length = 88
7 changes: 7 additions & 0 deletions pydantic_ai_slim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Coming soon

[![CI](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml/badge.svg?event=push)](https://github.com/pydantic/pydantic-ai/actions/workflows/ci.yml?query=branch%3Amain)
[![Coverage](https://coverage-badge.samuelcolvin.workers.dev/pydantic/pydantic-ai.svg)](https://coverage-badge.samuelcolvin.workers.dev/redirect/pydantic/pydantic-ai)
[![PyPI](https://img.shields.io/pypi/v/pydantic-ai.svg)](https://pypi.python.org/pypi/pydantic-ai)
[![versions](https://img.shields.io/pypi/pyversions/pydantic-ai.svg)](https://github.com/pydantic/pydantic-ai)
[![license](https://img.shields.io/github/license/pydantic/pydantic-ai.svg?v)](https://github.com/pydantic/pydantic-ai/blob/main/LICENSE)
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
from .exceptions import ModelRetry, UnexpectedModelBehavior, UserError

__all__ = 'Agent', 'CallContext', 'ModelRetry', 'UnexpectedModelBehavior', 'UserError', '__version__'
__version__ = version('pydantic_ai')
__version__ = version('pydantic_ai_slim')
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
51 changes: 51 additions & 0 deletions pydantic_ai_slim/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "pydantic-ai-slim"
version = "0.0.6a4"
description = "Agent Framework / shim to use Pydantic with LLMs"
authors = [
{ name = "Samuel Colvin", email = "samuel@pydantic.dev" },
]
license = "MIT"
readme = "README.md"
classifiers = [
"Development Status :: 4 - Beta",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Intended Audience :: System Administrators",
"License :: OSI Approved :: MIT License",
"Operating System :: Unix",
"Operating System :: POSIX :: Linux",
"Environment :: Console",
"Environment :: MacOS X",
"Topic :: Software Development :: Libraries :: Python Modules",
"Topic :: Internet",
]
requires-python = ">=3.9"
dependencies = [
"eval-type-backport>=0.2.0",
"griffe>=1.3.2",
"httpx>=0.27.2",
"logfire-api>=1.2.0",
"pydantic>=2.10",
]

[project.optional-dependencies]
openai = ["openai>=1.54.3"]
vertexai = ["google-auth>=2.36.0", "requests>=2.32.3"]
groq = ["groq>=0.12.0"]
logfire = ["logfire>=2.3"]

[tool.hatch.build.targets.wheel]
packages = ["pydantic_ai"]
49 changes: 19 additions & 30 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "pydantic-ai"
version = "0.0.5"
version = "0.0.6a4"
description = "Agent Framework / shim to use Pydantic with LLMs"
authors = [
{ name = "Samuel Colvin", email = "samuel@pydantic.dev" },
Expand Down Expand Up @@ -33,28 +33,17 @@ classifiers = [
"Topic :: Internet",
]
requires-python = ">=3.9"
dependencies = [
"eval-type-backport>=0.2.0",
"griffe>=1.3.2",
"httpx>=0.27.2",
"logfire-api>=1.2.0",
"pydantic>=2.10",
]
dependencies = ["pydantic-ai-slim[openai,vertexai,groq]==0.0.6a4"]

[project.optional-dependencies]
openai = ["openai>=1.54.3"]
vertexai = ["google-auth>=2.36.0", "requests>=2.32.3"]
groq = ["groq>=0.12.0"]
logfire = ["logfire>=2.3"]
examples = [
"asyncpg>=0.30.0",
"fastapi>=0.115.4",
"logfire[asyncpg,fastapi]>=2.3",
"python-multipart>=0.0.17",
"rich>=13.9.2",
"uvicorn>=0.32.0",
"pydantic-ai[openai,vertexai,groq]",
]
examples = ["pydantic-ai-examples==0.0.6a4"]

[tool.uv.sources]
pydantic-ai-slim = { workspace = true }
pydantic-ai-examples = { workspace = true }

[tool.uv.workspace]
members = ["pydantic_ai_slim", "pydantic_ai_examples"]

[dependency-groups]
dev = [
Expand All @@ -74,26 +63,26 @@ lint = [
"ruff>=0.6.9",
]
docs = [
"mkdocs",
"mkdocs>=1.6.1",
"mkdocs-glightbox>=0.4.0",
"mkdocs-material[imaging]",
"mkdocstrings-python",
"mkdocs-material[imaging]>=9.5.45",
"mkdocstrings-python>=1.12.2",
]

[tool.hatch.build.targets.wheel]
packages = ["pydantic_ai", "pydantic_ai_examples"]
only-include = ["/README.md"]

[tool.hatch.build.targets.sdist]
include = ["/README.md", "/Makefile", "/pydantic_ai", "/pydantic_ai_examples", "/tests"]
include = ["/README.md", "/Makefile", "/tests"]

[tool.ruff]
line-length = 120
target-version = "py39"
include = [
"pydantic_ai/**/*.py",
"pydantic_ai_slim/**/*.py",
"pydantic_ai_examples/**/*.py",
"tests/**/*.py",
"docs/**/*.py",
"pydantic_ai_examples/**/*.py",
]

[tool.ruff.lint]
Expand Down Expand Up @@ -134,7 +123,7 @@ quote-style = "single"
typeCheckingMode = "strict"
reportUnnecessaryTypeIgnoreComment = true
reportMissingTypeStubs = false
include = ["pydantic_ai", "tests", "pydantic_ai_examples"]
include = ["pydantic_ai_slim", "tests", "pydantic_ai_examples"]
venvPath = ".venv"
# see https://github.com/microsoft/pyright/issues/7771 - we don't want to error on decorated functions in tests
# which are not otherwise used
Expand All @@ -152,7 +141,7 @@ filterwarnings = [
# https://coverage.readthedocs.io/en/latest/config.html#run
[tool.coverage.run]
# required to avoid warnings about files created by create_module fixture
include = ["pydantic_ai/**/*.py", "tests/**/*.py"]
include = ["pydantic_ai_slim/**/*.py", "tests/**/*.py"]
omit = ["tests/test_live.py"]
branch = true

Expand Down
2 changes: 2 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# this file is a hack to work around CloudFlare Pages default build script that can't be avoided
# TODO remove once clouflare fix the bug
Empty file added tests/__init__.py
Empty file.
3 changes: 2 additions & 1 deletion tests/models/test_gemini.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@
_GeminiUsageMetaData,
)
from pydantic_ai.result import Cost
from tests.conftest import ClientWithHandler, IsNow, TestEnv

from ..conftest import ClientWithHandler, IsNow, TestEnv

pytestmark = pytest.mark.anyio

Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_groq.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
UserPrompt,
)
from pydantic_ai.result import Cost
from tests.conftest import IsNow, try_import

from ..conftest import IsNow, try_import

with try_import() as imports_successful:
from groq import AsyncGroq
Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
from pydantic_ai import UserError
from pydantic_ai.models import infer_model
from pydantic_ai.models.gemini import GeminiModel
from tests.conftest import TestEnv, try_import

from ..conftest import TestEnv, try_import

with try_import() as openai_imports_successful:
from pydantic_ai.models.openai import OpenAIModel
Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_model_function.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
from pydantic_ai.models.function import AgentInfo, DeltaToolCall, DeltaToolCalls, FunctionModel
from pydantic_ai.models.test import TestModel
from pydantic_ai.result import Cost
from tests.conftest import IsNow

from ..conftest import IsNow

pytestmark = pytest.mark.anyio

Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_model_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
UserPrompt,
)
from pydantic_ai.models.test import TestModel, _chars, _JsonSchemaTestData # pyright: ignore[reportPrivateUsage]
from tests.conftest import IsNow

from ..conftest import IsNow


def test_call_one():
Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_openai.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
UserPrompt,
)
from pydantic_ai.result import Cost
from tests.conftest import IsNow, try_import

from ..conftest import IsNow, try_import

with try_import() as imports_successful:
from openai import AsyncOpenAI
Expand Down
3 changes: 2 additions & 1 deletion tests/models/test_vertexai.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
from pytest_mock import MockerFixture

from pydantic_ai import UserError
from tests.conftest import IsNow, try_import

from ..conftest import IsNow, try_import

with try_import() as imports_successful:
from google.oauth2.service_account import Credentials
Expand Down
3 changes: 2 additions & 1 deletion tests/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
from pydantic_ai.models.function import AgentInfo, FunctionModel
from pydantic_ai.models.test import TestModel
from pydantic_ai.result import Cost, RunResult
from tests.conftest import IsNow, TestEnv

from .conftest import IsNow, TestEnv


def test_result_tuple():
Expand Down
5 changes: 3 additions & 2 deletions tests/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
from pydantic_ai.models import KnownModelName, Model
from pydantic_ai.models.function import AgentInfo, DeltaToolCall, DeltaToolCalls, FunctionModel
from pydantic_ai.models.test import TestModel
from tests.conftest import ClientWithHandler

from .conftest import ClientWithHandler

try:
from pydantic_ai.models.vertexai import VertexAIModel
Expand Down Expand Up @@ -88,7 +89,7 @@ async def customer_balance(cls, *, id: int, include_pending: bool) -> float:


def find_filter_examples() -> Iterable[CodeExample]:
for ex in find_examples('docs', 'pydantic_ai'):
for ex in find_examples('docs', 'pydantic_ai_slim'):
if ex.path.name != '_utils.py':
yield ex

Expand Down
Loading
Loading