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

Install the Python package from PyPI:

pip install phenoworks-sdk

To include the CLI:

pip install 'phenoworks-sdk[cli]'

These commands do not require a local copy of the PhenoWorks repository. See the installation guide for development installation and 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.1

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.1
File Size Uploaded
phenoworks_sdk-0.1.1.tar.gz 64.8 kB Details

Built distribution (wheel)

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

Total release size: 115.0 kB

Release files / phenoworks_sdk-0.1.1.tar.gz

Download URL phenoworks_sdk-0.1.1.tar.gz
Size 64.8 kB
Tags Source
SHA-256 checksum
How to use checksums
1d3a389016d5dcd609899cf2092e3d6e0bb501d6caa477569288cd182eab4df9
BLAKE2b-256 checksum
How to use checksums
74acc43ec980efdc1b844b7a7172c7d2807b526363f0da5f101ddbc3eb299ba0
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.1-py3-none-any.whl

Download URL phenoworks_sdk-0.1.1-py3-none-any.whl
Size 50.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c9a23066e07680533552297ce0e93f4c6fc695f71c900df5b2e20b38d026330d
BLAKE2b-256 checksum
How to use checksums
706bf68ef55d5f6581dd5b61f8105f1c01540c510bf84a96c79251f37949e0fd
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

This release

0.1.1 This release

2 release files

0.1.0

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