Example Code Runner (Python) avatar

Example Code Runner (Python)

Pricing

Pay per usage

Go to Apify Store
Example Code Runner (Python)

Example Code Runner (Python)

Python Actor to run code examples from the documentation via "Run on Apify" links.

Pricing

Pay per usage

Rating

4.5

(3)

Developer

Apify

Apify

Maintained by Apify

Actor stats

1

Bookmarked

1.3K

Total users

25

Monthly active users

7 days ago

Last modified

Share

The Actor behind the "Run on Apify" buttons in Python documentation, such as crawlee.dev/python and docs.apify.com. It takes a Python snippet as input and runs it, so a single Actor can execute code samples from both the Apify SDK and Crawlee.

Input

FieldTypeDescription
codestringPython code to execute. Must define a main function (sync or async).
{
"code": "async def main() -> None:\n print('Hello world!')\n"
}

If the snippet uses Actor, the runner hands over its own Actor context so the code can manage its lifecycle (SDK examples create their own context; Crawlee examples don't).

Run locally

This is a uv-managed project. You'll also need the Apify CLI.

uv sync
apify run -i '{"code": "async def main() -> None:\n print(\"hi\")\n"}'

Deploy to Apify

apify login # once, with your API token
apify push # build and deploy the Actor