Skip to content

refactor!: mark secondary arguments as keyword-only - #2318

Merged
vdusek merged 3 commits into
v2from
keyword-only-args
Oct 13, 2026
Merged

vdusek merged 3 commits into
v2from
keyword-only-args

Conversation

@vdusek

@vdusek vdusek commented Oct 13, 2026

Copy link
Copy Markdown
Collaborator

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

BREAKING CHANGE: Secondary arguments of the public API are keyword-only. The v2 upgrade guide lists the affected signatures.
@vdusek vdusek added the t-tooling Issues with this label are in the ownership of the tooling team. label Oct 13, 2026
@vdusek vdusek self-assigned this Oct 13, 2026
@vdusek
vdusek requested a review from apify-factory October 13, 2026 12:17
@vdusek
vdusek marked this pull request as ready for review October 13, 2026 12:17

@apify-factory apify-factory left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Looks good, nothing blocking.

@codecov

codecov Bot commented Oct 13, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 92.30769% with 1 line in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (v2@07bb164). Learn more about missing BASE report.

Files with missing lines Patch % Lines
src/crawlee/proxy_configuration.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             v2    #2318   +/-   ##
=====================================
  Coverage      ?   94.12%           
=====================================
  Files         ?      183           
  Lines         ?    13561           
  Branches      ?        0           
=====================================
  Hits          ?    12764           
  Misses        ?      797           
  Partials      ?        0           
Flag Coverage Δ
unit 94.12% <92.30%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 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 merged commit 672c58b into v2 Oct 13, 2026
28 checks passed
@vdusek
vdusek deleted the keyword-only-args branch October 13, 2026 12:25
@vdusek vdusek linked an issue Oct 13, 2026 that may be closed by this pull request
vdusek added a commit 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*
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.

Mark secondary arguments as keyword-only

3 participants