Metadata-Version: 2.5
Name: onedata-lambda-sdk
Version: 1.0.0
Summary: SDK for writing Onedata Automation lambdas
Project-URL: Homepage, https://onedata.org
Author: Bartosz Walkowicz
License: MIT License
        ===========
        
            Copyright (C) 2022: Onedata (onedata.org)
        
            Permission is hereby granted, free of charge, to any person
            obtaining a copy of this software and associated documentation
            files (the "Software"), to deal in the Software without
            restriction, including without limitation the rights to use, copy,
            modify, merge, publish, distribute, sublicense, and/or sell copies
            of the Software, and to permit persons to whom the Software is
            furnished to do so, subject to the following conditions:
        
            The above copyright notice and this permission notice shall be
            included in all copies or substantial portions of the Software.
        
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
            EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
            MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
            NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
            HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
            WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
            FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
            OTHER DEALINGS IN THE SOFTWARE.
License-File: LICENSE.txt
Keywords: automation,lambda,onedata,openfaas
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Typing :: Typed
Requires-Python: >=3.12
Requires-Dist: requests>=2.32
Description-Content-Type: text/markdown

# onedata-lambda-sdk

The Python SDK for writing **Onedata Automation lambdas** — the containerized
operations that run as job executors in automation workflows. You write one
handler function; the SDK turns the raw OpenFaaS request into typed jobs, runs
your handler, streams its results, sends the mandatory first heartbeat and keeps
the batch alive while it streams, and shapes the response the provider expects.

```python
from onedata_lambda_sdk import Job, JobContext, per_job

@per_job(max_workers=10)
def handle(job: Job[dict], ctx: JobContext[dict]) -> dict:
    return {"result": process(job.args)}
```

## Documentation

The full authoring documentation lives in [`docs/`](docs/):

- **[SDK overview](docs/_overview.md)** — the three-layer model (base image →
  SDK → handler) and how a job batch flows.
- **Guides** — [writing a handler](docs/guides/writing-a-handler.md),
  [a single-lambda repo](docs/guides/single-lambda-repo.md),
  [several lambdas in a uv workspace](docs/guides/shared-code-uv-workspace.md),
  [developing against a vendored SDK wheel](docs/guides/local-sdk-vendored-wheel.md),
  [testing](docs/guides/testing-a-lambda.md),
  [streaming logs and stats](docs/guides/streaming-logs-and-stats.md), and
  [file access](docs/guides/file-access.md).
- **[Runtime internals](docs/internals/runtime-and-lifecycle.md)** — for SDK
  maintainers.

The platform-side contract this SDK implements — how Oneprovider invokes a
lambda, the I/O and relay methods, heartbeats — is in the internal developer
documentation under `docs/automation/internals/lambda/` in
`onedata-dev-documentation`.

## Installation

Requires Python 3.12 or newer.

```bash
pip install onedata-lambda-sdk
```

## Development

```bash
make sync     # create the .venv from the lockfile
make check    # lint (ruff format-check + ruff check + mypy) + tests
make test     # pytest with coverage
```

Run `make help` for the full target list.

## Compatibility

`onedata-lambda-sdk` targets the **v3 lambda model** (`run` / `@per_job` /
`Job` / `JobContext`) and requires Oneprovider `21.02.5` or newer. A v3 lambda
builds on the `onedata/lambda-base-slim:v3` base image — see
[Lambda generations](docs/_overview.md#lambda-generations-v2-and-v3).
