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, find datasets by modality, and list their surveys.
  • 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. To see what a dataset holds, list its surveys with client.datasets.list_surveys(42) and filter assets with client.assets.list(dataset_id=42, data_product="image", modality="thermal"). See dataset discovery.

Upload files

Every file declares its data product, and images and orthomosaics also declare the sensor that captured them:

from phenoworks_sdk import PhenoWorksClient

with PhenoWorksClient() as client:
    client.upload_project_file(
        project_id=7,
        path="orthomosaic.tif",
        data_product="orthomosaic",
        modality="rgb",
    )

client.data_products.list() returns the accepted data products and extensions. See file uploads for processing methods and recovery.

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:", run.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(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 pipeline-runs run --dataset-id 42 --file pipeline.json --wait
phenoworks artifacts list --param pipeline_run_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.2.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.2.0
File Size Uploaded
phenoworks_sdk-0.2.0.tar.gz 71.6 kB Details

Built distribution (wheel)

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

Total release size: 126.6 kB

Release files / phenoworks_sdk-0.2.0.tar.gz

Download URL phenoworks_sdk-0.2.0.tar.gz
Size 71.6 kB
Tags Source
SHA-256 checksum
How to use checksums
cb7ce7aed47789ba93f4a40453f9ffbf83b2a74d064c16f104942df2a8cc2a1a
BLAKE2b-256 checksum
How to use checksums
2a96a094d8e568b3f0959e090648b5ba135fe914c09463c4531529de84993e17
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 25, 2026.

Transparency log

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

Download URL phenoworks_sdk-0.2.0-py3-none-any.whl
Size 54.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
855691c16634d39e17d0c1882f1c81fb5d34cdbbdf60489371d98e122f689c2d
BLAKE2b-256 checksum
How to use checksums
790094c9e93dec9e0e5af3cf1969238c31fcf5749486b42ea0c78b660a03262b
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 25, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.1

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