Metadata-Version: 2.4
Name: drylab-tools-sdk
Version: 0.4
Summary: Python SDK for Drylab Backend API - vault, jobs, and pipelines
Project-URL: Homepage, https://thedrylab.com
Project-URL: Documentation, https://docs.thedrylab.com
Project-URL: Repository, https://github.com/Drylab-AI/drylab-tools-sdk
Author-email: Drylab <hoangphan@thedrylab.com>
License-Expression: MIT
Keywords: api,bioinformatics,drylab,nextflow,sdk
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Bio-Informatics
Requires-Python: >=3.9
Requires-Dist: requests>=2.28.0
Provides-Extra: dev
Requires-Dist: black>=23.0.0; extra == 'dev'
Requires-Dist: mypy>=1.0.0; extra == 'dev'
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
Requires-Dist: pytest>=7.0.0; extra == 'dev'
Requires-Dist: responses>=0.23.0; extra == 'dev'
Requires-Dist: ruff>=0.1.0; extra == 'dev'
Description-Content-Type: text/markdown

# drylab-tools-sdk

Python SDK for the Drylab API. Provides simple access to vault files, Nextflow jobs, and pipelines.

> **Note**: This SDK (`drylab-tools-sdk`) is for AI-generated code running inside sandboxes.

## Installation

```bash
pip install drylab-tools-sdk
```

## Quick Start

```python
from drylab_tools_sdk import DrylabClient

# Initialize client (reads DRYLAB_API_KEY from environment)
client = DrylabClient()

# List files in a project folder
result = client.vault.list("/MyProject/data")
for file in result.files:
    print(f"{file.filename} ({file.size} bytes)")

# Upload a file
upload = client.vault.upload("/MyProject/output", "results.csv", size=1024)
import requests
with open("results.csv", "rb") as f:
    requests.put(upload.presigned_url, data=f)

# Submit a Nextflow job
job = client.jobs.submit(
    pipeline_id="rnaseq",
    params={
        "input": "/MyProject/data/samplesheet.csv",
        "outdir": "/MyProject/results",
        "genome": "GRCh38"
    },
    compute_profile="aws-batch"
)
print(f"Submitted job: {job.id}")

# Check job status
job = client.jobs.get(job.id)
print(f"Status: {job.status}, Complete: {job.is_complete}")

# List available pipelines
pipelines = client.pipelines.list()
for p in pipelines:
    print(f"{p.id}: {p.name}")

# Get pipeline parameter schema
schema = client.pipelines.get_schema("rnaseq")
for field in schema.required_fields:
    print(f"Required: {field.name} ({field.type})")
```

## Environment Variables

| Variable | Required | Description |
|----------|----------|-------------|
| `DRYLAB_API_KEY` | Yes | Execution token (injected by sandbox) |
| `DRYLAB_API_BASE_URL` | No | Backend URL (default: https://api.drylab.ai) |

## Documentation

For comprehensive documentation including:
- Authentication mechanism and token lifecycle
- Backend integration details
- Security considerations
- Error handling

See **[docs/drylab_tools_sdk.md](docs/drylab_tools_sdk.md)**

## API Reference

### Vault Operations

```python
# List files
result = client.vault.list("/Project/folder")

# Upload (get presigned URL)
upload = client.vault.upload("/Project/folder", "file.csv", size=1024)

# Upload file directly (convenience)
client.vault.upload_file("/Project/folder", "/local/path/file.csv")

# Download (get presigned URL)
download = client.vault.download("/Project/folder/file.csv")

# Download file directly (convenience)
client.vault.download_file("/local/path", vault_path="/Project/folder/file.csv")

# Download folder as zip
download = client.vault.download_folder("/Project/results")
```

### Job Operations

```python
# Submit job
job = client.jobs.submit("rnaseq", params={...}, compute_profile="aws-batch")

# Get job status
job = client.jobs.get(job.id)

# List jobs
jobs = client.jobs.list(status="running", limit=10)

# Cancel job
client.jobs.cancel(job.id)

# Wait for completion
job = client.jobs.wait_for_completion(job.id, timeout=3600)
```

### Pipeline Operations

```python
# List pipelines
pipelines = client.pipelines.list()

# Get pipeline details
pipeline = client.pipelines.get("rnaseq")

# Get parameter schema
schema = client.pipelines.get_schema("rnaseq")

# Register custom pipeline
pipeline = client.pipelines.register(
    name="my-pipeline",
    pipeline_zip_path="/Project/pipelines/my-pipeline.zip",
    schema={"fields": [...]}
)
```

## License

MIT
