Skip to content

Commit d4601d7

Browse files
vdusekclaude
andcommitted
refactor!: Enforce keyword-only arguments across all public and internal APIs
Add `*` separator to all function and method signatures (117 functions across 16 files) to enforce keyword-only argument passing. Update all internal callers (707 call sites in src/ and tests/), documentation examples (31 docs files), and website examples to use keyword syntax. BREAKING CHANGE: All function parameters (beyond self/cls) are now keyword-only. Callers must use `func(param=value)` instead of `func(value)`. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 638ad1d commit d4601d7

86 files changed

Lines changed: 859 additions & 812 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

docs/01_overview/code/01_usage_async.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66

77
async def main() -> None:
8-
apify_client = ApifyClientAsync(TOKEN)
8+
apify_client = ApifyClientAsync(token=TOKEN)
99

1010
# Start an Actor and wait for it to finish.
11-
actor_client = apify_client.actor('john-doe/my-cool-actor')
11+
actor_client = apify_client.actor(actor_id='john-doe/my-cool-actor')
1212
call_result = await actor_client.call()
1313

1414
if call_result is None:
1515
print('Actor run failed.')
1616
return
1717

1818
# Fetch results from the Actor run's default dataset.
19-
dataset_client = apify_client.dataset(call_result.default_dataset_id)
19+
dataset_client = apify_client.dataset(dataset_id=call_result.default_dataset_id)
2020
list_items_result = await dataset_client.list_items()
2121
print(f'Dataset: {list_items_result}')

docs/01_overview/code/01_usage_sync.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55

66

77
def main() -> None:
8-
apify_client = ApifyClient(TOKEN)
8+
apify_client = ApifyClient(token=TOKEN)
99

1010
# Start an Actor and wait for it to finish.
11-
actor_client = apify_client.actor('john-doe/my-cool-actor')
11+
actor_client = apify_client.actor(actor_id='john-doe/my-cool-actor')
1212
call_result = actor_client.call()
1313

1414
if call_result is None:
1515
print('Actor run failed.')
1616
return
1717

1818
# Fetch results from the Actor run's default dataset.
19-
dataset_client = apify_client.dataset(call_result.default_dataset_id)
19+
dataset_client = apify_client.dataset(dataset_id=call_result.default_dataset_id)
2020
list_items_result = dataset_client.list_items()
2121
print(f'Dataset: {list_items_result}')

docs/01_overview/code/02_auth_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
async def main() -> None:
77
# Client initialization with the API token.
8-
apify_client = ApifyClientAsync(TOKEN)
8+
apify_client = ApifyClientAsync(token=TOKEN)

docs/01_overview/code/02_auth_sync.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@
55

66
def main() -> None:
77
# Client initialization with the API token.
8-
apify_client = ApifyClient(TOKEN)
8+
apify_client = ApifyClient(token=TOKEN)

docs/01_overview/code/03_dataset_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
async def main() -> None:
7-
apify_client = ApifyClientAsync(TOKEN)
8-
dataset_client = apify_client.dataset('dataset-id')
7+
apify_client = ApifyClientAsync(token=TOKEN)
8+
dataset_client = apify_client.dataset(dataset_id='dataset-id')
99

1010
# Lists items from the Actor's dataset.
1111
dataset_items = (await dataset_client.list_items()).items

docs/01_overview/code/03_dataset_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
def main() -> None:
7-
apify_client = ApifyClient(TOKEN)
8-
dataset_client = apify_client.dataset('dataset-id')
7+
apify_client = ApifyClient(token=TOKEN)
8+
dataset_client = apify_client.dataset(dataset_id='dataset-id')
99

1010
# Lists items from the Actor's dataset.
1111
dataset_items = dataset_client.list_items().items

docs/01_overview/code/03_input_async.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
async def main() -> None:
7-
apify_client = ApifyClientAsync(TOKEN)
8-
actor_client = apify_client.actor('username/actor-name')
7+
apify_client = ApifyClientAsync(token=TOKEN)
8+
actor_client = apify_client.actor(actor_id='username/actor-name')
99

1010
# Define the input for the Actor.
1111
run_input = {

docs/01_overview/code/03_input_sync.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55

66
def main() -> None:
7-
apify_client = ApifyClient(TOKEN)
8-
actor_client = apify_client.actor('username/actor-name')
7+
apify_client = ApifyClient(token=TOKEN)
8+
actor_client = apify_client.actor(actor_id='username/actor-name')
99

1010
# Define the input for the Actor.
1111
run_input = {

docs/02_concepts/code/01_async_support.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66

77

88
async def main() -> None:
9-
apify_client = ApifyClientAsync(TOKEN)
10-
actor_client = apify_client.actor('my-actor-id')
9+
apify_client = ApifyClientAsync(token=TOKEN)
10+
actor_client = apify_client.actor(actor_id='my-actor-id')
1111

1212
# Start the Actor and get the run ID
1313
run_result = await actor_client.start()
14-
run_client = apify_client.run(run_result.id)
14+
run_client = apify_client.run(run_id=run_result.id)
1515
log_client = run_client.log()
1616

1717
# Stream the logs

docs/02_concepts/code/02_collection_async.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55

66
async def main() -> None:
7-
apify_client = ApifyClientAsync(TOKEN)
7+
apify_client = ApifyClientAsync(token=TOKEN)
88

99
# Collection clients do not require a parameter
1010
actor_collection_client = apify_client.actors()

0 commit comments

Comments
 (0)