diff --git a/Makefile b/Makefile index 4372ceb9..8f9a4b7a 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ sources = pydantic_ai tests .PHONY: install # Install the package, dependencies, and pre-commit for local development install: .uv .pre-commit - uv sync --frozen + uv sync --frozen --all-extras pre-commit install --install-hooks .PHONY: format # Format the code diff --git a/demos/weather.py b/demos/weather.py index f14fe240..b32538fd 100644 --- a/demos/weather.py +++ b/demos/weather.py @@ -1,11 +1,15 @@ import json from devtools import debug -import logfire from pydantic_ai import Agent -logfire.configure() +try: + import logfire +except ImportError: + pass +else: + logfire.configure() weather_agent: Agent[None, str] = Agent('openai:gpt-4o', system_prompt='Be concise, reply with one sentence.') diff --git a/tests/conftest.py b/tests/conftest.py index aee29872..de60c1b2 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,19 +8,22 @@ __all__ = 'IsNow', 'TestEnv' -try: - import logfire -except ImportError: - pass -else: - logfire.configure(send_to_logfire=False) - if TYPE_CHECKING: def IsNow(*args: Any, **kwargs: Any) -> datetime: ... else: from dirty_equals import IsNow +try: + from logfire.testing import CaptureLogfire +except ImportError: + pass +else: + + @pytest.fixture(autouse=True) + def logfire_disable(capfire: CaptureLogfire): + pass + class TestEnv: __test__ = False