{{ message }}
refactor!: Introduce fully typed clients [WIP]#554
Closed
vdusek wants to merge 70 commits into
Closed
Conversation
e470329 to
64a173b
Compare
64a173b to
c410e21
Compare
Pijukatel
reviewed
Jan 8, 2026
39bc762 to
894685c
Compare
There was a problem hiding this comment.
Pull request overview
This PR introduces fully typed API clients with Pydantic models generated from OpenAPI specifications. It represents a major architectural refactoring to improve type safety and developer experience.
Changes:
- Generates Pydantic models from OpenAPI specs using datamodel-code-generator
- Refactors HTTP client architecture into modular, well-structured components
- Introduces comprehensive type annotations across all client methods
- Adds new integration tests for webhooks, schedules, user operations, store, and more
- Removes dependency on apify-shared and adds pydantic as core dependency
Reviewed changes
Copilot reviewed 94 out of 97 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pyproject.toml | Adds pydantic dependency, configures datamodel-code-generator, removes apify-shared |
| src/apify_client/_config.py | New immutable configuration dataclass for client settings |
| src/apify_client/_consts.py | New constants and enums (ActorJobStatus, WebhookEventType, etc.) |
| src/apify_client/_statistics.py | Renames Statistics to ClientStatistics |
| src/apify_client/_http_clients/ | Refactored HTTP client into modular sync/async/base structure |
| src/apify_client/errors.py | Improved error handling and docstrings |
| src/apify_client/_logging.py | Reorganized logging infrastructure |
| src/apify_client/_resource_clients/ | Complete refactor with typed responses |
| tests/unit/ | Updated unit tests for renamed classes and new structure |
| tests/integration/ | New comprehensive integration tests |
| docs/, website/ | Updated examples to use typed models |
| scripts/ | Updated for new file structure |
Comments suppressed due to low confidence (1)
src/apify_client/_resource_clients/key_value_store.py:854
- This assignment to 'keys_public_url' is unnecessary as it is redefined before this value is used.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Reflects OpenAPI spec changes: - Removed GetOpenApiResponse meta-schema (~40 unnecessary classes) - Removed Folder enum (now simple bool field) Models reduced from ~245 to 203 classes. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Update all resource clients to use the new standardized response model names after OpenAPI schema refactoring. Changes: - Remove "Get" prefix from all response model imports and usages - Update model names: Get*Response → *Response - Update list model names: GetListOf*Response → ListOf*Response - Consolidated response wrappers now use single names (e.g., ActorResponse instead of separate Create/Get/UpdateActorResponse) Affected clients: - actor, actor_collection - actor_env_var, actor_env_var_collection - actor_version, actor_version_collection - build, build_collection - dataset, dataset_collection - key_value_store, key_value_store_collection - request_queue, request_queue_collection - run, run_collection - schedule, schedule_collection - store_collection - task, task_collection - user - webhook, webhook_collection, webhook_dispatch Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Regenerated from updated OpenAPI specs that removed: - MonthlyUsageCycle (now uses UsageCycle) - CreateOrUpdateEnvVarRequest (now uses EnvVar) This removes the duplicate Python classes from the generated models. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
ListOfSchedules and ListOfStoreActors now extend PaginationResponse instead of duplicating the pagination fields. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
BuildsMeta.client_ip now uses `str | None` instead of `IPv4Address | None`, matching RunMeta and supporting both IPv4 and IPv6 addresses. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
BuildsMeta.origin now uses the RunOrigin enum instead of a plain string, matching the type used by RunMeta.origin. This improves type safety and consistency across the codebase. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- WebhookDispatch.status now uses WebhookDispatchStatus enum - WebhookDispatch.event_type now uses WebhookEventType enum - ExampleWebhookDispatch.status now uses WebhookDispatchStatus enum - New WebhookDispatchStatus enum added (SUCCEEDED, FAILED) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- ScheduleAction.type now uses ScheduleActionType enum - ScheduleActions.type now uses ScheduleActionType enum - ScheduleCreateActions.type now uses ScheduleActionType enum - New ScheduleActionType enum added (RUN_ACTOR, RUN_ACTOR_TASK) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

This PR introduces fully typed API clients, with models generated directly from OpenAPI specifications.
Description
pyproject.tomland theMakefile.apify/apify-docsfor details - fix(openapi): Fix OpenApi specification apify-docs#2169.apify/apify-sdk-pythonfor details - refactor!: Adapt to apify-client v3 apify-sdk-python#719.Issues
Testing