Skip to content

feat: generate TypedDict types for input-side models#738

Open
vdusek wants to merge 1 commit intomasterfrom
feat/generate-typeddicts-for-input-models
Open

feat: generate TypedDict types for input-side models#738
vdusek wants to merge 1 commit intomasterfrom
feat/generate-typeddicts-for-input-models

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented Apr 17, 2026

Summary

Adds TypedDict counterparts for generated Pydantic models so users passing plain dicts to resource-client methods get full type-checker support without having to import Pydantic models.

  • Generate TypedDicts alongside Pydantic models via a second datamodel-code-generator invocation (--output-model-type typing.TypedDict) in poe generate-models / poe generate-models-from-file.
  • Move generated output to a new src/apify_client/_generated/ subpackage (_models.py, _typeddicts.py). Top-level src/apify_client/_models.py and src/apify_client/_typeddicts.py become stable shim modules that re-export from _generated/ — public import paths stay the same.
  • Extend scripts/postprocess_generated_models.py to prune and rename TypedDicts.
  • Hand-maintain RequestInputDict / RequestDeleteInputDict for shapes not yet exposed by the OpenAPI spec.
  • Update resource-client method signatures (actor, task, task collection, request queue) to accept both Pydantic models and TypedDicts.
  • Update manual_regenerate_models.yaml workflow to commit the regenerated _generated/*.py files and mention TypedDicts in PR body.
  • Update .rules.md to describe the new two-tier layout.

Closes #666.

Add TypedDict counterparts for generated Pydantic models so users passing
plain dicts to resource-client methods get full type-checker support without
importing Pydantic models. Closes #666.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vdusek vdusek added adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. labels Apr 17, 2026
@vdusek vdusek self-assigned this Apr 17, 2026
@github-actions github-actions bot added this to the 138th sprint - Tooling team milestone Apr 17, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Apr 17, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 17, 2026

Codecov Report

❌ Patch coverage is 97.59036% with 2 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.34%. Comparing base (3d4ce3f) to head (1eb5c1d).
⚠️ Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/apify_client/_types.py 60.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #738      +/-   ##
==========================================
+ Coverage   95.26%   95.34%   +0.08%     
==========================================
  Files          45       48       +3     
  Lines        5115     5182      +67     
==========================================
+ Hits         4873     4941      +68     
+ Misses        242      241       -1     
Flag Coverage Δ
integration 95.34% <97.59%> (+0.08%) ⬆️

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

☔ View full report in Codecov by Sentry.
📢 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Generate TypedDict types for input-side models

2 participants