Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 by a `ChildRunTracker` (by default 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(child_run_tracker=None)` 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
4 changes: 4 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 ChildRun, ChildRunRecord, ChildRunTracker
from apify._configuration import Configuration
from apify._consts import ActorEnvVars, ApifyEnvVars
from apify._proxy_configuration import ProxyConfiguration, ProxyInfo
Expand All @@ -26,6 +27,9 @@
'ActorEnvVars',
'ActorEventTypes',
'ApifyEnvVars',
'ChildRun',
'ChildRunRecord',
'ChildRunTracker',
'Configuration',
'Event',
'EventAbortingData',
Expand Down
448 changes: 229 additions & 219 deletions src/apify/_actor.py

Large diffs are not rendered by default.

Loading