refactor!: Mark secondary arguments as keyword-only#917
Open
vdusek wants to merge 2 commits into
Open
Conversation
Secondary parameters (default_value, charged_event_name, count, key, kvs_name) on Actor.get_value, Actor.push_data, Actor.charge, Actor.use_state, and ChargingManager.charge are now keyword-only. Primary subjects such as key, data, and event_name stay positional. Improves call-site readability and prevents argument-order mistakes when extending signatures. Mirrors apify-client#766. BREAKING CHANGE: callers passing the affected arguments positionally must switch to keyword form. See docs/04_upgrading/upgrading_to_v4.md for details.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #917 +/- ##
==========================================
+ Coverage 87.00% 87.04% +0.03%
==========================================
Files 48 48
Lines 2956 2956
==========================================
+ Hits 2572 2573 +1
+ Misses 384 383 -1
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:
|
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
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 byActor.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.mdfor the migration guide.