runpod-doc-worker
Getting started

Install and adopt

Install runpod-doc-worker from a pinned release and connect its reusable modules to your own worker.

Install runpod-doc-worker from a tagged GitHub archive. Version 0.1.0 is not documented as a PyPI package, so use the PEP 508 direct-reference form.

Add the dependency

Put this line in requirements.txt when the worker uses S3 result packaging:

runpod-doc-worker[s3] @ https://github.com/sergeyshmakov/runpod-doc-worker/archive/refs/tags/v0.1.0.tar.gz

Remove [s3] if the worker only returns inline results or base64 archives:

runpod-doc-worker @ https://github.com/sergeyshmakov/runpod-doc-worker/archive/refs/tags/v0.1.0.tar.gz

The s3 extra installs boto3. The base package depends on httpx and httpcore and requires Python 3.10.12 or newer — that patch release is where tarfile gained the data extraction filter, which the response reader depends on outright rather than reimplementing.

Declare worker-specific values

Call configure() once when the process starts:

from runpod_doc_worker import WorkerConfig, configure
from runpod_doc_worker.config import DEFAULT_VOLUME_ROOTS

configure(
    WorkerConfig(
        env_prefix="ACME",
        logger_name="acme-worker",
        volume_roots=DEFAULT_VOLUME_ROOTS + ("/worker",),
        model_globs=("models--acme--parser*",),
    )
)

The package stores this configuration process-wide. Configure it during boot, before a job can call transport, logging, or diagnostic helpers.

Declare the output contract

An artifact manifest tells the package which engine-written files can become inline response fields:

from runpod_doc_worker.contract.artifacts import Artifact

MANIFEST = (
    Artifact("markdown", ("{basename}.md",), kind="text"),
    Artifact(
        "blocks",
        ("{basename}_blocks.json",),
        kind="json",
        default=[],
    ),
    Artifact("images", ("images/*",), kind="b64map"),
)

The worker's handler calls the transport and packaging functions. This package does not register a handler, start the RunPod runtime, or decide the job envelope.

Upgrade deliberately

The API is pre-release. Pin a tag rather than a branch, then review the changelog before changing that tag.

Know which harness an image is running

runpod_doc_worker.__version__ reads the installed distribution metadata, so a worker can report the harness it was built against.

An editable install does not report a truthful version

pip install -e records the metadata that existed when the link was made and does not update it as the source changes. A consumer wired that way can run current code while __version__ reports whatever it was first linked at. Install from a pinned archive wherever that string matters — a released image, or a test run meant to match one.

Continue with worker configuration or input transport.

On this page