Skip to content
2 changes: 1 addition & 1 deletion .rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Don't introduce a shared Pydantic base model to centralize `model_config`. Each

- **`Actor`** (`_actor.py`) is a `lazy-object-proxy` wrapping `_ActorType`. It works both as a class (`Actor.is_at_home()`) and as a context manager (`async with Actor:`); on `__aenter__` the proxy's `__wrapped__` is replaced with the active `_ActorType` instance.
- **`Configuration`** (`_configuration.py`) extends Crawlee's `Configuration` and is populated from `APIFY_*` environment variables.
- **Named child runs** (`_child_runs.py`) — runs started with `run_name` are persisted in the default key-value store so they can be reattached after a migration or resurrection; exposed through `Actor.child_runs`.
- **Child runs** (`_child_runs.py`) — every run started by `Actor.start`, `call`, `start_task` and `call_task` is recorded in the child run registry (`{"runs": {"<kind>:<value>": record}}`, kinds `run` and `name`), kept in the default key-value store under `APIFY_ACTOR_CHILD_RUNS`, so a later process of the parent (after a migration, reboot, or resurrection) gets them back; exposed through `Actor.child_runs()`. `Actor(track_child_runs=False)` turns tracking off. The registry format is shared with the JS SDK.
- **Storage clients** (`storage_clients/`) implement Crawlee's storage client interface: `ApifyStorageClient` talks to the Apify API (separate sub-clients for single vs. shared request queues), `FileSystemStorageClient` adds Apify-specific key-value store behavior, and `SmartApifyStorageClient` delegates to the cloud client on the platform and to the local one elsewhere.
- **Events** — `ApifyEventManager` receives platform events over a WebSocket.
- **Errors** — `apify.errors` only re-exports the exceptions from `apify_client.errors`; the SDK defines no error classes of its own, and API calls raise the client exceptions unchanged.
Expand Down
3 changes: 3 additions & 0 deletions src/apify/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
)

from apify._actor import Actor
from apify._child_runs import ChildRunClient, ChildRunRecord
from apify._configuration import Configuration
from apify._consts import ActorEnvVars, ApifyEnvVars
from apify._proxy_configuration import ProxyConfiguration, ProxyInfo
Expand All @@ -26,6 +27,8 @@
'ActorEnvVars',
'ActorEventTypes',
'ApifyEnvVars',
'ChildRunClient',
'ChildRunRecord',
'Configuration',
'Event',
'EventAbortingData',
Expand Down
444 changes: 224 additions & 220 deletions src/apify/_actor.py

Large diffs are not rendered by default.

Loading
Loading