Skip to content

Conversation

@vdusek
Copy link
Contributor

@vdusek vdusek commented Dec 10, 2025

This PR introduces fully typed API clients, with models generated directly from OpenAPI specifications.

Description

Issues

Testing

  • Add "easy win" additional integration tests, but avoid complex workflows (e.g. Actor creation, execution, and waiting for completion - these things are still being tested only from the SDK).

@vdusek vdusek self-assigned this Dec 10, 2025
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 10, 2025
@github-actions github-actions bot added this to the 129th sprint - Tooling team milestone Dec 10, 2025
@vdusek vdusek changed the title refactor!: Add fully typed clients refactor!: Introduce fully typed clients [WIP] Dec 10, 2025
@vdusek vdusek force-pushed the typed-clients branch 2 times, most recently from e470329 to 64a173b Compare December 17, 2025 12:18
@codecov
Copy link

codecov bot commented Dec 19, 2025

Codecov Report

❌ Patch coverage is 93.78392% with 126 lines in your changes missing coverage. Please review.
✅ Project coverage is 95.04%. Comparing base (6210e80) to head (403d98f).
⚠️ Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...apify_client/_resource_clients/_resource_client.py 81.94% 26 Missing ⚠️
src/apify_client/_resource_clients/user.py 80.39% 10 Missing ⚠️
src/apify_client/_resource_clients/actor.py 90.10% 9 Missing ⚠️
src/apify_client/_resource_clients/run.py 92.68% 9 Missing ⚠️
src/apify_client/_resource_clients/dataset.py 91.39% 8 Missing ⚠️
.../apify_client/_resource_clients/key_value_store.py 93.54% 8 Missing ⚠️
src/apify_client/_resource_clients/schedule.py 87.23% 6 Missing ⚠️
...apify_client/_resource_clients/webhook_dispatch.py 70.00% 6 Missing ⚠️
src/apify_client/_resource_clients/task.py 92.30% 5 Missing ⚠️
src/apify_client/_apify_client.py 95.74% 4 Missing ⚠️
... and 13 more
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #554       +/-   ##
===========================================
+ Coverage   75.92%   95.04%   +19.12%     
===========================================
  Files          42       42               
  Lines        2471     4558     +2087     
===========================================
+ Hits         1876     4332     +2456     
+ Misses        595      226      -369     
Flag Coverage Δ
integration 93.41% <91.36%> (+24.53%) ⬆️
unit 70.42% <51.15%> (+5.91%) ⬆️

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.

@vdusek vdusek force-pushed the typed-clients branch 4 times, most recently from 39bc762 to 894685c Compare January 26, 2026 13:33
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

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

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Introduce fully typed Py client Write integration tests

3 participants