Repository navigation
refactor!: Mark secondary arguments as keyword-only - #766
Merged
Merged
Conversation
Secondary parameters (e.g. signature, content_type, count, idempotency_key, method, expires_in) on KVS record methods, RunClient.charge, ApifyApiError, and several internal helpers are now keyword-only. Primary subjects such as key, value, event_name, and response stay positional. Improves call-site readability and prevents argument-order mistakes when extending signatures. BREAKING CHANGE: callers passing the affected arguments positionally must switch to keyword form. See docs/04_upgrading/upgrading_to_v3.mdx for details.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #766 +/- ##
==========================================
+ Coverage 95.68% 96.05% +0.36%
==========================================
Files 48 48
Lines 5218 5218
==========================================
+ Hits 4993 5012 +19
+ Misses 225 206 -19
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Pijukatel
approved these changes
Apr 28, 2026
This was referenced Apr 29, 2026
vdusek
added a commit
to apify/apify-sdk-python
that referenced
this pull request
Jun 5, 2026
## Summary Closes #881. Reshapes function/method signatures across the SDK public API so that secondary parameters must be passed as keyword arguments. Primary "subject" arguments (e.g. `key`, `data`, `event_name`) stay positional. Mirrors what was done in the client: apify/apify-client-python#766. ### Affected APIs `Actor`: - `get_value(key, *, default_value=None)` - `push_data(data, *, charged_event_name=None)` - `charge(event_name, *, count=1)` - `use_state(default_value=None, *, key=None, kvs_name=None)` `ChargingManager` / `ChargingManagerImplementation` (returned by `Actor.get_charging_manager()`): - `charge(event_name, *, count=1)` Crawlee-overriding methods (e.g. `ProxyConfiguration.new_proxy_info`, the storage clients) were intentionally left untouched — Crawlee's base signatures are positional, so making the overrides keyword-only would diverge from the base class. ## Why Keyword-only parameters at API boundaries make call sites self-documenting and prevent breakage when new options are added between existing arguments. **BREAKING CHANGE** for v4.0 — see `docs/04_upgrading/upgrading_to_v4.md` for the migration guide.
vdusek
added a commit
to apify/crawlee-python
that referenced
this pull request
Oct 13, 2026
Secondary arguments across the public API are now keyword-only, the same way as in apify/apify-client-python#766. The main argument of each call (key, value, data, selector, path) stays positional. Named call sites read better, and new options can go anywhere in a signature without breaking existing callers. The full list is in the v2 upgrade guide. It covers the context helpers (`push_data`, `add_requests`, `block_requests`), `BasicCrawler.get_data`/`export_data`, `KeyValueStore.set_value` and the key iterators, `Dataset.export_to`, `ConcurrencySettings`, `RequestList`, `ProxyConfiguration.new_url`/`new_proxy_info`, the adaptive crawler factories and selector helpers, `HeaderGenerator.get_specific_headers`, `BrowserController.new_page`, `PlaywrightPersistentBrowser` and `find_links` on the parsers. `KeyValueStore.get_value` keeps `default_value` positional to match Crawlee JS. The three arguments of `new_proxy_info` now default to `None`, as on `new_url`. Closes: #1863 *✍️ Drafted by Claude Code*
vdusek
added a commit
to apify/crawlee-python
that referenced
this pull request
Oct 16, 2026
Secondary arguments across the public API are now keyword-only, the same way as in apify/apify-client-python#766. The main argument of each call (key, value, data, selector, path) stays positional. Named call sites read better, and new options can go anywhere in a signature without breaking existing callers. The full list is in the v2 upgrade guide. It covers the context helpers (`push_data`, `add_requests`, `block_requests`), `BasicCrawler.get_data`/`export_data`, `KeyValueStore.set_value` and the key iterators, `Dataset.export_to`, `ConcurrencySettings`, `RequestList`, `ProxyConfiguration.new_url`/`new_proxy_info`, the adaptive crawler factories and selector helpers, `HeaderGenerator.get_specific_headers`, `BrowserController.new_page`, `PlaywrightPersistentBrowser` and `find_links` on the parsers. `KeyValueStore.get_value` keeps `default_value` positional to match Crawlee JS. The three arguments of `new_proxy_info` now default to `None`, as on `new_url`. Closes: #1863 *✍️ Drafted by Claude Code*
vdusek
added a commit
to apify/crawlee-python
that referenced
this pull request
Nov 5, 2026
Secondary arguments across the public API are now keyword-only, the same way as in apify/apify-client-python#766. The main argument of each call (key, value, data, selector, path) stays positional. Named call sites read better, and new options can go anywhere in a signature without breaking existing callers. The full list is in the v2 upgrade guide. It covers the context helpers (`push_data`, `add_requests`, `block_requests`), `BasicCrawler.get_data`/`export_data`, `KeyValueStore.set_value` and the key iterators, `Dataset.export_to`, `ConcurrencySettings`, `RequestList`, `ProxyConfiguration.new_url`/`new_proxy_info`, the adaptive crawler factories and selector helpers, `HeaderGenerator.get_specific_headers`, `BrowserController.new_page`, `PlaywrightPersistentBrowser` and `find_links` on the parsers. `KeyValueStore.get_value` keeps `default_value` positional to match Crawlee JS. The three arguments of `new_proxy_info` now default to `None`, as on `new_url`. Closes: #1863 *✍️ Drafted by Claude Code*
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.
Summary
Reshapes function/method signatures across the public API so that secondary parameters must be passed as keyword arguments. Primary "subject" arguments (e.g.
key,value,event_name,response) stay positional.Affected APIs:
KeyValueStoreClient.{get_record, get_record_as_bytes, stream_record, set_record}(sync + async) —signature/content_typeare now keyword-only.RunClient.{charge, get_status_message_watcher}(sync + async) —count,idempotency_key,to_logger,check_period,timeoutare now keyword-only.ApifyApiError(response, attempt, *, method='GET')—methodis now keyword-only.Why
Keyword-only parameters at API boundaries make call sites self-documenting and prevent breakage when new options are added between existing arguments.