Skip to content

refactor!: Mark secondary arguments as keyword-only#917

Open
vdusek wants to merge 2 commits into
masterfrom
refactor/secondary-arguments-keyword-only
Open

refactor!: Mark secondary arguments as keyword-only#917
vdusek wants to merge 2 commits into
masterfrom
refactor/secondary-arguments-keyword-only

Conversation

@vdusek
Copy link
Copy Markdown
Contributor

@vdusek vdusek commented May 29, 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.

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.
@vdusek vdusek requested a review from szaganek as a code owner May 29, 2026 14:18
@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 May 29, 2026
@vdusek vdusek self-assigned this May 29, 2026
@github-actions github-actions Bot added this to the 141st sprint - Tooling team milestone May 29, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label May 29, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 29, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.04%. Comparing base (94bdd37) to head (d0489f4).

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     
Flag Coverage Δ
e2e 37.58% <71.42%> (ø)
integration 58.93% <71.42%> (+0.03%) ⬆️
unit 75.81% <100.00%> (ø)

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 requested a review from janbuchar May 29, 2026 15:09
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.

Mark secondary arguments as keyword-only

2 participants