pydantic-claude-code 0.7.5__tar.gz → 0.7.6__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (36) hide show
  1. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/PKG-INFO +2 -2
  2. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/README.md +1 -1
  3. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/pyproject.toml +1 -1
  4. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/__init__.py +1 -1
  5. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/model.py +17 -1
  6. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_model.py +21 -0
  7. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/uv.lock +2 -2
  8. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/.github/workflows/ci.yml +0 -0
  9. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/.github/workflows/publish.yml +0 -0
  10. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/.gitignore +0 -0
  11. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/LICENSE +0 -0
  12. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/examples/basic.py +0 -0
  13. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/install.sh +0 -0
  14. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/scripts/sync_gist.sh +0 -0
  15. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/__main__.py +0 -0
  16. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/auth.py +0 -0
  17. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/clai2.py +0 -0
  18. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/config.py +0 -0
  19. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/credentials.py +0 -0
  20. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/flow.py +0 -0
  21. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/provider.py +0 -0
  22. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/py.typed +0 -0
  23. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/storage.py +0 -0
  24. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/src/pydantic_ai_claude_code/updates.py +0 -0
  25. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/conftest.py +0 -0
  26. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_callback_server.py +0 -0
  27. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_clai2.py +0 -0
  28. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_credentials.py +0 -0
  29. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_flow.py +0 -0
  30. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_install.py +0 -0
  31. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_integration.py +0 -0
  32. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_keyring_store.py +0 -0
  33. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_provider.py +0 -0
  34. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_refresh.py +0 -0
  35. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_storage.py +0 -0
  36. {pydantic_claude_code-0.7.5 → pydantic_claude_code-0.7.6}/tests/test_updates.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: pydantic-claude-code
3
- Version: 0.7.5
3
+ Version: 0.7.6
4
4
  Summary: Use your Claude Code subscription from a Pydantic AI Agent or CLAI2, with full tool support
5
5
  Project-URL: Source, https://gist.github.com/mpfaffenberger/bd75c7b424ffdc6d81645bfe7de822d3
6
6
  Project-URL: Homepage, https://pypi.org/project/pydantic-claude-code/
@@ -340,7 +340,7 @@ uv run pytest
340
340
 
341
341
  To release, bump `version` in `pyproject.toml` and `__version__` in
342
342
  `src/pydantic_ai_claude_code/__init__.py` (a test checks they match), merge, and
343
- push a matching tag (`git tag v0.7.5 && git push origin v0.7.5`). The `Publish` workflow tests,
343
+ push a matching tag (`git tag v0.7.6 && git push origin v0.7.6`). The `Publish` workflow tests,
344
344
  builds, and uploads it to PyPI with the `PYPI_API_TOKEN` repository secret. Then run
345
345
  `scripts/sync_gist.sh` to publish the release to the install gist, which is what the one-liner and the
346
346
  update notice install from.
@@ -311,7 +311,7 @@ uv run pytest
311
311
 
312
312
  To release, bump `version` in `pyproject.toml` and `__version__` in
313
313
  `src/pydantic_ai_claude_code/__init__.py` (a test checks they match), merge, and
314
- push a matching tag (`git tag v0.7.5 && git push origin v0.7.5`). The `Publish` workflow tests,
314
+ push a matching tag (`git tag v0.7.6 && git push origin v0.7.6`). The `Publish` workflow tests,
315
315
  builds, and uploads it to PyPI with the `PYPI_API_TOKEN` repository secret. Then run
316
316
  `scripts/sync_gist.sh` to publish the release to the install gist, which is what the one-liner and the
317
317
  update notice install from.
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "pydantic-claude-code"
7
- version = "0.7.5"
7
+ version = "0.7.6"
8
8
  description = "Use your Claude Code subscription from a Pydantic AI Agent or CLAI2, with full tool support"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10,<3.15"
@@ -26,7 +26,7 @@ from .model import ClaudeCodeModel
26
26
  from .provider import ClaudeCodeProvider
27
27
  from .storage import ClaudeCodeTokenStore, KeyringTokenStore, default_auth_path, default_store
28
28
 
29
- __version__ = "0.7.5"
29
+ __version__ = "0.7.6"
30
30
  """Matches `version` in pyproject.toml (a test checks), so a copied folder knows its release."""
31
31
 
32
32
 
@@ -2,6 +2,7 @@
2
2
 
3
3
  from __future__ import annotations
4
4
 
5
+ import inspect
5
6
  from collections.abc import AsyncGenerator, Iterator
6
7
  from contextlib import asynccontextmanager, contextmanager
7
8
  from typing import Any
@@ -77,8 +78,23 @@ class ClaudeCodeModel(AnthropicModel):
77
78
  messages: list[ModelMessage],
78
79
  model_request_parameters: ModelRequestParameters,
79
80
  model_settings: AnthropicModelSettings,
81
+ **kwargs: Any,
80
82
  ) -> tuple[str | list[BetaTextBlockParam], list[BetaMessageParam]]:
81
- system, anthropic_messages = await super()._map_message(messages, model_request_parameters, model_settings)
83
+ """Pydantic AI's mapping, with the persona first in its `system`.
84
+
85
+ `**kwargs` is what Pydantic AI's version passes beyond the arguments above, which the mapping accepts whether
86
+ or not that version declares them: a release added `continues_thread` for Anthropic message threads, and an
87
+ override without it failed every request with `TypeError: ... got an unexpected keyword argument`. A keyword
88
+ a newer version still declares (`continues_thread`) is forwarded to its mapping; the rest are dropped, since
89
+ the mapping they'd go to doesn't take them.
90
+ """
91
+ accepted = inspect.signature(super()._map_message).parameters
92
+ system, anthropic_messages = await super()._map_message(
93
+ messages,
94
+ model_request_parameters,
95
+ model_settings,
96
+ **{name: value for name, value in kwargs.items() if name in accepted},
97
+ )
82
98
  return _persona_first(system), anthropic_messages
83
99
 
84
100
  async def request(
@@ -9,6 +9,7 @@ import pytest
9
9
  from anthropic.types.beta import BetaTextBlockParam
10
10
  from pydantic_ai import Agent
11
11
  from pydantic_ai.messages import ModelMessage, ModelRequest, ModelResponse, SystemPromptPart, TextPart, UserPromptPart
12
+ from pydantic_ai.models import ModelRequestParameters
12
13
  from pydantic_ai.models.anthropic import AnthropicModelSettings
13
14
  from pydantic_ai.providers.anthropic import AnthropicProvider
14
15
 
@@ -90,6 +91,26 @@ async def test_a_new_session_marks_the_tools_and_instructions_for_reuse(messages
90
91
  assert body["cache_control"] == ONE_HOUR, "the conversation keeps its moving one-hour breakpoint"
91
92
 
92
93
 
94
+ async def test_the_mapping_takes_every_keyword_pydantic_ai_may_pass_it(messages_stub: MessagesServer) -> None:
95
+ """`AnthropicModel` calls the mapping with keywords from its own signature, and Pydantic AI adds them as it grows.
96
+
97
+ `continues_thread`, added for Anthropic message threads, reached users through CLAI2's bleeding-edge build
98
+ before any release carried it, and an override that didn't take it failed every request with
99
+ `TypeError: ClaudeCodeModel._map_message() got an unexpected keyword argument 'continues_thread'`. Forwarding
100
+ `**kwargs` is what takes whatever a later version passes, without the plugin naming each keyword.
101
+ """
102
+ provider = ClaudeCodeProvider(
103
+ ClaudeCodeCredentials(access_token="sub-token", refresh_token="refresh"), base_url=messages_stub.url
104
+ )
105
+ model = ClaudeCodeModel("claude-opus-5-5", provider=provider)
106
+ keywords = {"continues_thread": True, "a_keyword_added_later": True}
107
+ system, sent = await model._map_message( # pyright: ignore[reportPrivateUsage]
108
+ [ModelRequest([UserPromptPart("go on")])], ModelRequestParameters(), {}, **keywords
109
+ )
110
+ assert _texts(system) == [PERSONA]
111
+ assert sent == [{"role": "user", "content": [{"type": "text", "text": "go on"}]}]
112
+
113
+
93
114
  PERSONA = config.CLAUDE_CODE_SYSTEM_PROMPT
94
115
  SUMMARY = "Summary of previous conversation:\n\n## Intent\nShip the plugin."
95
116
 
@@ -1,5 +1,5 @@
1
1
  version = 1
2
- revision = 3
2
+ revision = 5
3
3
  requires-python = ">=3.10, <3.15"
4
4
  resolution-markers = [
5
5
  "python_full_version >= '3.14' and sys_platform == 'emscripten'",
@@ -1430,7 +1430,7 @@ wheels = [
1430
1430
 
1431
1431
  [[package]]
1432
1432
  name = "pydantic-claude-code"
1433
- version = "0.7.5"
1433
+ version = "0.7.6"
1434
1434
  source = { editable = "." }
1435
1435
  dependencies = [
1436
1436
  { name = "keyring" },