Skip to main content

PhenoWorks SDK

PhenoWorks SDK is a Python package for working with PhenoWorks from scripts, notebooks, and the command line. It connects to your PhenoWorks server using an API key and gives you access to projects, datasets, pipelines, and analysis outputs with the permissions of your account.

Use it to:

  • Browse projects and studies, and find datasets by modality.
  • Upload files and manage datasets, assets, plots, and annotations.
  • Submit pipelines, monitor their progress, and retrieve previous runs.
  • Download artifacts for downstream analysis and machine-learning workflows.
  • Discover analysis blocks and manage account-level installations.

The package provides PhenoWorksClient, AsyncPhenoWorksClient, and the optional phenoworks CLI. The Python client requires Python 3.11 or later and HTTPX.

Installation

From the PhenoWorks repository root, install the Python package:

pip install ./packages/phenoworks-sdk

To include the CLI:

pip install './packages/phenoworks-sdk[cli]'

These commands install from this checkout. See the installation guide for uv workspace usage.

Connect to PhenoWorks

Create an API key in your account settings and configure your server connection:

export PHENOWORKS_API_URL="https://your-phenoworks-server"
export PHENOWORKS_API_KEY="YOUR_API_KEY"

Then list the projects available to your account:

from phenoworks_sdk import PhenoWorksClient

with PhenoWorksClient() as client:
    projects = client.projects.list()
    for project in projects:
        print(project["id"], project["name"])

You can also pass base_url and api_key directly to the client. Keep real keys out of committed code and shared notebooks.

Find datasets by modality

Replace the example project ID with one from your account:

from phenoworks_sdk import PhenoWorksClient

with PhenoWorksClient() as client:
    datasets = client.datasets.filter_by_modality("thermal", project_id=7)
    for dataset in datasets:
        print(dataset["id"], dataset["name"])

This filters datasets by their declared supported_modalities. It does not verify that matching assets have been uploaded.

Run a pipeline and download results

Save a valid pipeline definition as pipeline.json, using analysis blocks available to your account. Replace 42 with the dataset you want to process.

import json
from pathlib import Path

from phenoworks_sdk import PhenoWorksClient

with PhenoWorksClient() as client:
    definition = json.loads(Path("pipeline.json").read_text(encoding="utf-8"))
    run = client.run_pipeline(dataset_id=42, json_pipeline=definition)
    print("Pipeline:", run.pipeline_id, "Operation:", run.operation_id)
    run.wait(timeout=3600)

    for artifact in run.artifacts():
        if artifact["status"] == "ready":
            destination = Path("results") / f"artifact-{artifact['id']}"
            client.artifacts.download(artifact["id"], destination)

Inspect each artifact's type, format, and metadata to select the output needed for your analysis. Downloads require a local filename and refuse to overwrite existing files unless overwrite=True is supplied.

To retrieve a previous run, use client.pipeline_run(pipeline_id=123) inside a client context. This reconnects to the existing run without submitting work. See pipelines and artifacts for discovery, waiting, error handling, and downloads.

Command-line usage

The CLI uses the same server URL and API key environment variables:

phenoworks auth me
phenoworks datasets filter-by-modality thermal --param project_id=7
phenoworks pipelines run --dataset-id 42 --file pipeline.json --wait
phenoworks artifacts list --param pipeline_id=123
phenoworks artifacts download 789 --output ./results/features.csv

Use IDs and filenames from your own account. Run phenoworks --help to explore commands. The CLI guide covers uploads, JSON payloads, and migration from the backend CLI.

Documentation

To preview the documentation from the SDK package directory:

uv run --group docs mkdocs serve

Markdown sources live in mkdocs/; mkdocs build --strict generates the site in docs/. Generated HTML is ignored by Git.

Development

Run tests and build the package from the repository root:

uv run --package phenoworks-sdk --extra dev pytest packages/phenoworks-sdk/tests
uv build --package phenoworks-sdk

Version 0.1 targets the API in this PhenoWorks checkout. Most SDK tests use mock HTTP responses; the optional live-server test requires explicit configuration. See the development guide before running it.

Contributions follow the PhenoWorks contribution guidelines. Report vulnerabilities using the project's security policy.

License

Licensed under Apache 2.0.

Release files for phenoworks-sdk 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for phenoworks-sdk 0.1.0
File Size Uploaded
phenoworks_sdk-0.1.0.tar.gz 64.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for phenoworks-sdk 0.1.0
File Interpreter ABI Platform
phenoworks_sdk-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 115.0 kB

Release files / phenoworks_sdk-0.1.0.tar.gz

Download URL phenoworks_sdk-0.1.0.tar.gz
Size 64.8 kB
Tags Source
SHA-256 checksum
How to use checksums
3a1117ff2502002746dd88c07d4996b4c244c067922bef751c49c918e049fa2f
BLAKE2b-256 checksum
How to use checksums
61aaee2605d0d2ef180e3f9d85f198399d67b38d8017538bf02fe93646044829
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release files / phenoworks_sdk-0.1.0-py3-none-any.whl

Download URL phenoworks_sdk-0.1.0-py3-none-any.whl
Size 50.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d36785bcf5041fc5193db0b99201a57a862a171953684e34f699c62edb9987c6
BLAKE2b-256 checksum
How to use checksums
f3277ee8d5c71120aa74a9dc50befab7e4a1e7c9116adfe7048618886af22e0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Sep 22, 2026.

Transparency log

Release history Release notifications | RSS feed

0.2.0

2 release files

0.1.1

2 release files

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page