Skip to content

Commit 393d55c

Browse files
authored
docs: Fix docstring typos, add missing docs groups, and document platform purge() (#982)
Documentation-only portion of the v4 major-release cleanup. - Fix docstring typos and stale claims in `Actor`: `MIIGRATING` → `MIGRATING`, drop the nonexistent `call_task` `content_type` argument, drop the "in seconds" note on `timeout` (the parameter is a `timedelta`), correct the `exit_process` default note, and fix the `task_id` description. - Fix `Configuration` docstrings: "prising" → "pricing", and the concatenated `web_server_port` description. - Replace mkdocs-style cross-references in `events/_types.py` with plain backticks. - Add `@docs_group` plus a docstring to `ApifyRequestQueueMetadata`, and `@docs_group` to `ApifyFileSystemStorageClient`. - Document in the v4 upgrading guide that platform storages raise `NotImplementedError` on `purge()` (use `drop()` instead). Local file-system storages are unaffected.
1 parent cd0e6bf commit 393d55c

5 files changed

Lines changed: 18 additions & 12 deletions

File tree

src/apify/_actor.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ def __init__(
118118
configuration: The Actor configuration to use. If not provided, a default configuration is created.
119119
configure_logging: Whether to set up the default logging configuration.
120120
exit_process: Whether the Actor should call `sys.exit` when the context manager exits.
121-
Defaults to True, except in IPython, Pytest, and Scrapy environments.
121+
Defaults to True, except in IPython and Scrapy environments.
122122
exit_code: The exit code the Actor should use when exiting.
123123
status_message: Final status message to display upon Actor termination.
124124
event_listeners_timeout: Maximum time to wait for Actor event listeners to complete before exiting.
@@ -912,7 +912,7 @@ async def start(
912912
a non-zero status code.
913913
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit specified
914914
in the default run configuration for the Actor.
915-
timeout: Optional timeout for the run, in seconds. By default, the run uses timeout specified in
915+
timeout: Optional timeout for the run. By default, the run uses timeout specified in
916916
the default run configuration for the Actor. Using `inherit` will set timeout of the other Actor
917917
to the time remaining from this Actor timeout.
918918
force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
@@ -1019,7 +1019,7 @@ async def call(
10191019
a non-zero status code.
10201020
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit specified
10211021
in the default run configuration for the Actor.
1022-
timeout: Optional timeout for the run, in seconds. By default, the run uses timeout specified in
1022+
timeout: Optional timeout for the run. By default, the run uses timeout specified in
10231023
the default run configuration for the Actor. Using `inherit` will set timeout of the other Actor
10241024
to the time remaining from this Actor timeout.
10251025
force_permission_level: Override the Actor's permissions for this run. If not set, the Actor will run
@@ -1088,17 +1088,16 @@ async def call_task(
10881088
directly rather than an Actor task, please use the `Actor.call`
10891089
10901090
Args:
1091-
task_id: The ID of the Actor to be run.
1091+
task_id: The ID of the Actor task to be run.
10921092
task_input: Overrides the input to pass to the Actor run.
10931093
token: The Apify API token to use for this request (defaults to the `APIFY_TOKEN` environment variable).
1094-
content_type: The content type of the input.
10951094
build: Specifies the Actor build to run. It can be either a build tag or build number. By default,
10961095
the run uses the build specified in the default run configuration for the Actor (typically latest).
10971096
restart_on_error: If true, the Task run process will be restarted whenever it exits with
10981097
a non-zero status code.
10991098
memory_mbytes: Memory limit for the run, in megabytes. By default, the run uses a memory limit specified
11001099
in the default run configuration for the Actor.
1101-
timeout: Optional timeout for the run, in seconds. By default, the run uses timeout specified in
1100+
timeout: Optional timeout for the run. By default, the run uses timeout specified in
11021101
the default run configuration for the Actor. Using `inherit` will set timeout of the other Actor to the
11031102
time remaining from this Actor timeout.
11041103
webhooks: Optional webhooks (https://docs.apify.com/webhooks) associated with the Actor run, which can
@@ -1217,7 +1216,7 @@ async def reboot(
12171216
# Call all the listeners for the PERSIST_STATE and MIGRATING events, and wait for them to finish.
12181217
# PERSIST_STATE listeners are called to allow the Actor to persist its state before the reboot.
12191218
# MIGRATING listeners are called to allow the Actor to gracefully stop in-progress tasks before
1220-
# the reboot. Typically, crawlers are listening for the MIIGRATING event to stop processing new requests.
1219+
# the reboot. Typically, crawlers are listening for the MIGRATING event to stop processing new requests.
12211220
# We can't just emit the events and wait for all listeners to finish,
12221221
# because this method might be called from an event listener itself, and we would deadlock.
12231222
persist_state_listeners = flatten(

src/apify/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ class Configuration(CrawleeConfiguration):
426426
'actor_web_server_port',
427427
'apify_container_port',
428428
),
429-
description='TCP port for the Actor to start an HTTP server on'
429+
description='TCP port for the Actor to start an HTTP server on. '
430430
'This server can be used to receive external messages or expose monitoring and control interfaces',
431431
),
432432
] = 4321
@@ -458,7 +458,7 @@ class Configuration(CrawleeConfiguration):
458458
| None,
459459
Field(
460460
alias='apify_actor_pricing_info',
461-
description='JSON string with prising info of the actor',
461+
description='JSON string with pricing info of the actor',
462462
discriminator='pricing_model',
463463
),
464464
BeforeValidator(_parse_actor_pricing_info),

src/apify/events/_types.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,8 @@
2020
ActorEventTypes = Literal['systemInfo', 'persistState', 'migrating', 'aborting']
2121
"""Event types emitted by the Apify platform during an Actor run.
2222
23-
This is the Apify-specific subset of [`Event`][crawlee.events.Event] — for the full set
24-
(including framework-level events like `SESSION_RETIRED` or `BROWSER_LAUNCHED`) use
25-
[`Event`][crawlee.events.Event] from `apify`.
23+
This is the Apify-specific subset of `Event`. For the full set (including framework-level events
24+
like `SESSION_RETIRED` or `BROWSER_LAUNCHED`), use `Event` from `apify`.
2625
"""
2726

2827

src/apify/storage_clients/_apify/_models.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,13 @@ class CachedRequest(BaseModel):
102102
"""The expiration time of the lock on the request."""
103103

104104

105+
@docs_group('Storage data')
105106
class ApifyRequestQueueMetadata(RequestQueueMetadata):
107+
"""Extended request queue metadata model for Apify platform.
108+
109+
Includes additional Apify-specific fields.
110+
"""
111+
106112
model_config = ConfigDict(alias_generator=to_camel)
107113

108114
stats: Annotated[

src/apify/storage_clients/_file_system/_storage_client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,15 @@
99

1010
from ._dataset_client import ApifyFileSystemDatasetClient
1111
from ._key_value_store_client import ApifyFileSystemKeyValueStoreClient
12+
from apify._utils import docs_group
1213

1314
if TYPE_CHECKING:
1415
from collections.abc import Hashable
1516

1617
from crawlee.storage_clients._file_system import FileSystemKeyValueStoreClient
1718

1819

20+
@docs_group('Storage clients')
1921
class ApifyFileSystemStorageClient(FileSystemStorageClient):
2022
"""Apify-specific implementation of the file system storage client.
2123

0 commit comments

Comments
 (0)