Skip to content

Empty Python Actor (uv)

An Actor with the Scrapely SDK set up and dependencies managed by the uv package manager, so you can build any tool you need.

Create it locally

$scrapely create my-actor --template python-uv

Main file

.PY
my_actor/main.py
"""Module defines the main entry point for the Scrapely Actor.

Feel free to modify this file to suit your specific needs.

To build Scrapely Actors, utilize the Scrapely SDK toolkit, read more at the official documentation:
"""

from __future__ import annotations

import sys

from scrapely import Actor


async def main() -> None:
    """Define a main entry point for the Scrapely Actor.

    This coroutine is executed using `asyncio.run()`, so it must remain an asynchronous function for proper execution.
    Asynchronous execution is required for communication with the Scrapely platform.

    This is a minimal, general-purpose Actor: it reads an input, does a little work with it, logs its progress, and
    stores a result in the dataset. Replace the body with whatever your Actor should do, for example a scraper, a
    browser automation, an AI agent, an MCP server, or a web server.
    """
    async with Actor:
        # uv manages both the dependencies and the Python version, so the interpreter running here is exactly the
        # one pinned in `.python-version`.
        python_version = '.'.join(map(str, sys.version_info[:3]))
        Actor.log.info(f'Hello from a uv-managed Scrapely Actor, running on Python {python_version}!')

        # Retrieve the Actor input. The structure of the input is defined in `input_schema.json`.
        actor_input = await Actor.get_input() or {}
        name = actor_input.get('name', 'world')
        repeat = actor_input.get('repeat', 3)

        # Do something with the input. Here we simply greet the given name a few times.
        for i in range(1, repeat + 1):
            Actor.log.info(f'[{i}/{repeat}] Hello, {name}!')

        # Save a structured result to the dataset, which is a table-like storage.
        await Actor.push_data(
            {
                'greeting': f'Hello, {name}!',
                'repeated': repeat,
                'python_version': python_version,
                'managed_by': 'uv',
            }
        )

Empty Python Actor (uv)

An Actor with the Scrapely SDK set up and dependencies managed by the uv package manager, so you can build any tool you need.

Included features

  • Scrapely SDK — Actor lifecycle, input, storage and proxies
  • uv — dependency management
  • Input schema — define and validate the Actor's input (.actor/input_schema.json)
  • Dataset schema — structured results with a preview view (.actor/dataset_schema.json)

Getting started locally

uv sync
scrapely run      # run the Actor locally

Deploying to Scrapely

Create an Actor from this template in the Scrapely Console (Develop new → template → Git). Scrapely creates a repository in your account, pushes this code, and builds the Actor. Every push to your repository triggers a new build.

G2
4.7/5
Excellent
Trustpilot

The internet is full of data.
Start owning yours.

Scrape.ly gives you the infrastructure, the tooling, and the team to extract, process, and operationalize web data at any scale. Setup takes minutes. The advantage lasts forever.

No credit card. No setup calls.