Skip to content

feat(python): type and document explicit cache key selectors - #214

Merged
lan17 merged 2 commits into
mainfrom
codex/python-explicit-cache-keys
Sep 26, 2026
Merged

lan17 merged 2 commits into
mainfrom
codex/python-explicit-cache-keys

Conversation

@lan17

@lan17 lan17 commented Sep 26, 2026

Copy link
Copy Markdown
Owner

Python's docs currently lead with inferred id_arg keys even though cache_key already supports TypeScript-style explicit {id, args} selection. Make that existing selector the primary documented style and export CacheKeySpec / KeyScalar for typed selectors. Preserve decorated functions' parameter and result types for synchronous, asynchronous, and custom-awaitable loaders, including use with asyncio.create_task.

Keep id_arg, adapters, and ignored arguments supported. Explicit selectors still receive the original positional and keyword arguments; loader defaults are deliberately not injected because that could break callbacks or change existing keys. Document matching selector defaults and method self, and cover these conventions with runtime and consumer type-check regressions. Cache execution and Redis wire behavior are unchanged.

Validation:

  • make check-python: 2,228 passed, including focused mypy consumer checks and committed conformance smoke histories.
  • make integration-python: 343 passed against Redis and 343 against Valkey, including Cluster, invalidation vectors, and the changed Redis documentation example.
  • make docs and make audit: passed.
  • Python wheel/sdist build and isolated installation smoke checks: passed.
  • Ruff on changed Python files and independent source review: clean.

— Levicus 🤖

@codecov-commenter

codecov-commenter commented Sep 26, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.73%. Comparing base (bb27803) to head (0680d61).

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #214   +/-   ##
=======================================
  Coverage   93.73%   93.73%           
=======================================
  Files          78       78           
  Lines       11351    11357    +6     
  Branches      657      656    -1     
=======================================
+ Hits        10640    10646    +6     
  Misses        641      641           
  Partials       70       70           
Flag Coverage Δ
go 91.17% <ø> (ø)
python 92.08% <100.00%> (+0.03%) ⬆️
rust 94.29% <ø> (ø)
typescript 96.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@lan17
lan17 merged commit 4d485a4 into main Sep 26, 2026
21 checks passed
@lan17
lan17 deleted the codex/python-explicit-cache-keys branch September 26, 2026 21:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants