Skip to content

Bump pytz from 2021.3 to 2022.5 - #17

Merged
JSv4 merged 1 commit into
mainfrom
dependabot/pip/pytz-2022.5
Oct 27, 2022
Merged

JSv4 merged 1 commit into
mainfrom
dependabot/pip/pytz-2022.5

Conversation

@dependabot

@dependabot dependabot Bot commented on behalf of github Oct 26, 2022

Copy link
Copy Markdown
Contributor

Bumps pytz from 2021.3 to 2022.5.

Commits
  • 1ab3481 Bump version numbers to 2022.5 / 2022e
  • c5900e5 IANA 2022e
  • 872168c Squashed 'tz/' changes from 0fc8f915a..16bd7a384
  • 04b5402 Bump version numbers to 2022.4/2022d
  • 8eeefc3 Squashed 'tz/' changes from b61a7acb4..82693eb52
  • d901daf IANA 2022d
  • a6867f1 Bump version numbers to 2022.2.1/2022b
  • 07aa4d9 Revert inclusion of PACKRATDATA=backzone
  • a5c6756 Update dead link
  • b247b50 Remove obsolete Travis config
  • Additional commits viewable in compare view

Dependabot compatibility score

Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


Dependabot commands and options

You can trigger Dependabot actions by commenting on this PR:

  • @dependabot rebase will rebase this PR
  • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
  • @dependabot merge will merge this PR after your CI passes on it
  • @dependabot squash and merge will squash and merge this PR after your CI passes on it
  • @dependabot cancel merge will cancel a previously requested merge and block automerging
  • @dependabot reopen will reopen this PR if it is closed
  • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
  • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
  • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)

Bumps [pytz](https://github.com/stub42/pytz) from 2021.3 to 2022.5.
- [Release notes](https://github.com/stub42/pytz/releases)
- [Commits](stub42/pytz@release_2021.3...release_2022.5)

---
updated-dependencies:
- dependency-name: pytz
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
@dependabot dependabot Bot added dependencies Pull requests that update a dependency file python Pull requests that update Python code labels Oct 26, 2022
@codecov-commenter

Copy link
Copy Markdown

Codecov Report

Merging #17 (535bfd4) into main (befbf93) will not change coverage.
The diff coverage is n/a.

@@           Coverage Diff           @@
##             main      #17   +/-   ##
=======================================
  Coverage   66.19%   66.19%           
=======================================
  Files          47       47           
  Lines        1855     1855           
=======================================
  Hits         1228     1228           
  Misses        627      627           

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@JSv4
JSv4 merged commit 5eb030a into main Oct 27, 2022
@JSv4
JSv4 deleted the dependabot/pip/pytz-2022.5 branch October 27, 2022 02:53
JSv4 added a commit that referenced this pull request Apr 29, 2026
JSv4 added a commit that referenced this pull request May 28, 2026
- Document legacy history-processor signature contract in
  make_pydantic_ai_agent: ProcessHistory dispatches on the first
  parameter's type annotation, so an untyped 2-arg processor crashes
  at runtime — callers wanting (ctx, messages) MUST annotate as
  RunContext.
- Add CLAUDE.md pitfall #17: history_processors.py import-time
  RuntimeError on pydantic-ai dataclass-shape drift.
- Type on_in_run_shrink as Callable[[InRunShrinkEvent], None] (direct
  import — there is no cycle to defer behind TYPE_CHECKING).
- Soften "no shrinkable content" / "no older messages" logs from
  WARNING to INFO with rationale; pin the level in the unit test.
- Replace fragile result[1] index in test_drops_older_thinking_parts
  with a next(...) lookup keyed on the ToolCallPart's tool_call_id.
- Promote the trim-notice marker to a public constant
  (IN_RUN_TRIM_NOTICE_MARKER in constants/context_guardrails.py); the
  private template composes from it and tests import the public form.
- Add upstream pydantic-ai source pointers to _agent_capabilities()
  so the AttributeError tripwire is faster to diagnose on a bump.
JSv4 added a commit that referenced this pull request May 28, 2026
* Add IN_RUN_* constants for in-run history compaction

* Extend CompactionConfig with in-run history-processor knobs

Adds four new fields to CompactionConfig (in_run_enabled,
in_run_keep_recent_pairs, in_run_tool_return_target_chars,
in_run_drop_thinking) wired to the constants added in the previous
commit.  __post_init__ validates the two integer fields are >= 1.
Covers the new surface with four SimpleTestCase tests.

* Add on_in_run_shrink telemetry callback to PydanticAIDependencies

* Add shrink_old_artifacts_processor for in-run history compaction

* Address Task 4 review findings: production config path, DRY, empty-parts guard

Fix 1: Add `compaction: CompactionConfig` field to PydanticAIDependencies so
the in-run HistoryProcessor reads its knobs from the correct production path
(`deps.compaction`) instead of the non-existent `deps.config.compaction`.
Update `_resolve_config` to try `deps.compaction` first (production), then
`deps.config_compaction` (test-stub legacy), then fall back to defaults.

Fix 2: Collapse the duplicated string/non-string branches in
`_shrink_tool_return_part` into a single unified path — stringify once, then
apply the same truncation arithmetic regardless of the original type.

Fix 3: Guard `_shrink_message`'s ModelResponse branch so that dropping
ThinkingParts from a response that contains only ThinkingParts leaves the
message intact rather than producing an empty parts list.

Fix 4: Correct docstring typo in `_split_protected_suffix` ("any trailing
leading ModelRequest" → "any trailing ModelRequest").

Fix 5: Add missing `tool_returns_shrunk == 1` assertion to
`test_drops_older_thinking_parts`.

Two new regression tests added: `test_resolves_compaction_from_deps_compaction_field`
and `test_thinking_only_modelresponse_is_not_emptied`. Total: 12 tests, all passing.

* Inject in-run history processor in make_pydantic_ai_agent

Wire shrink_old_artifacts_processor as the first history_processors entry
on every Agent constructed through the factory chokepoint. Caller-supplied
processors are preserved after ours.

Also tightens the ctx parameter annotation on the processor from Any to
RunContext so pydantic-ai's takes_run_context() introspection invokes the
two-argument form. The _FakeRunContext call sites in
test_history_processors.py get type: ignore[arg-type] (runtime-correct;
mypy suppression only).

The Agent(history_processors=...) constructor parameter is deprecated in
pydantic-ai 1.62 in favour of a v2 API (capabilities=[ProcessHistory(fn)]
or Hooks(before_model_request=fn)) — but that replacement API does NOT
ship in 1.62 yet (neither ProcessHistory nor Hooks is exported), so the
deprecated form is the only workable path. We silence the forward-looking
PydanticAIDeprecationWarning with a narrowly-scoped warnings filter that
targets only that custom warning class.

* Surface in-run shrink events in the streaming timeline

Wire the in-run HistoryProcessor's on_in_run_shrink callback in
_stream_core so that when in-loop compaction fires during a streamed
chat, a ThoughtEvent is appended to the TimelineBuilder and becomes
visible in the UI timeline. Non-streaming (_chat_raw) callers leave the
callback unset and continue to receive log-only telemetry from the
processor.

* CHANGELOG: in-run history compaction via pydantic-ai history_processors

* Migrate in-run processor to pydantic-ai capabilities API (ProcessHistory)

* CHANGELOG: drop obsolete deprecation note now that we use capabilities API

* Address PR #1817 review: propagate CompactionConfig + polish

Main fix (Medium severity from Claude review):
- ``PydanticAICoreAgent._apply_context_budget`` now copies the full
  ``config.compaction`` onto ``agent_deps.compaction``. Previously
  only ``threshold_ratio`` was forwarded, so per-conversation
  overrides to ``in_run_enabled`` / ``in_run_keep_recent_pairs`` /
  ``in_run_tool_return_target_chars`` / ``in_run_drop_thinking``
  silently defaulted inside the in-run history processor. Pinned by
  a new regression test in ``TestRefreshContextBudgetFallback``.

Cleanup:
- ``_resolve_config`` drops the ``config_compaction`` test-stub
  fallback branch. ``_FakeDeps`` in ``test_history_processors.py``
  now mirrors the production attribute name (``compaction``), and
  the previously-separate ``_ProdDeps`` test stub collapses into
  ``_FakeDeps``.
- ``test_drops_older_thinking_parts`` replaces the positional
  ``result[7]`` lookup with a predicate-based find so the test stays
  self-documenting if the fixture grows.
- ``test_pydantic_ai_factory.py`` routes the three new
  ``root_capability.capabilities`` accesses through a single
  ``_agent_capabilities`` helper that documents the brittle internal
  contract and raises a precise tripwire if pydantic-ai renames it.
- ``history_processors.py`` consolidates the dual
  ``import dataclasses`` + ``from dataclasses import dataclass``
  into a single ``from dataclasses import dataclass, replace``.

CHANGELOG updated under ### Fixed.

* Address PR #1817 Claude review #2: defensive guards + callback test

Items addressed from the second review pass (the first review's items
were already in 7501a95 / c8916ea):

- Import-time guard: assert ToolReturnPart, ModelRequest, ModelResponse
  remain stdlib @DataClass. dataclasses.replace silently fails on
  BaseModel instances; the outer try/except in
  shrink_old_artifacts_processor would have swallowed the resulting
  TypeError into a no-op. The guard makes the next pydantic-ai bump
  that breaks the assumption visible in CI.

- New regression test test_callback_exception_does_not_propagate
  pinning the contract that a raising on_in_run_shrink callback is
  caught locally inside the callback block (logger.exception fires),
  not by the outer try/except — so the actual shrink work survives
  telemetry-sink failures. The previous # pragma: no cover - defensive
  marker is dropped now that the path is covered.

- Docstring clarity on _split_protected_suffix explaining the "pairs"
  terminology vs. the response-boundary anchor (the split point is the
  Nth most-recent ModelResponse; trailing ModelRequests stay with the
  recent suffix).

- Inline comment near the threshold computation noting that
  threshold_ratio is shared by design between the in-run processor and
  the outer MessageHistoryService compaction — future tuning should
  treat both layers together.

CHANGELOG updated with two new Fixed entries.

* Address PR #1817 Claude review #3

- Document legacy history-processor signature contract in
  make_pydantic_ai_agent: ProcessHistory dispatches on the first
  parameter's type annotation, so an untyped 2-arg processor crashes
  at runtime — callers wanting (ctx, messages) MUST annotate as
  RunContext.
- Add CLAUDE.md pitfall #17: history_processors.py import-time
  RuntimeError on pydantic-ai dataclass-shape drift.
- Type on_in_run_shrink as Callable[[InRunShrinkEvent], None] (direct
  import — there is no cycle to defer behind TYPE_CHECKING).
- Soften "no shrinkable content" / "no older messages" logs from
  WARNING to INFO with rationale; pin the level in the unit test.
- Replace fragile result[1] index in test_drops_older_thinking_parts
  with a next(...) lookup keyed on the ToolCallPart's tool_call_id.
- Promote the trim-notice marker to a public constant
  (IN_RUN_TRIM_NOTICE_MARKER in constants/context_guardrails.py); the
  private template composes from it and tests import the public form.
- Add upstream pydantic-ai source pointers to _agent_capabilities()
  so the AttributeError tripwire is faster to diagnose on a bump.

---------

Signed-off-by: JSIV <5049984+JSv4@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file python Pull requests that update Python code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants