Skip to main content

cvh-client

Python API client for the Community Visualization Hub (CVH) — a platform for creating and sharing interactive genomic, spatial, and single-cell visualizations powered by Gosling.js and Vitessce. Designed for use in Jupyter notebooks.

Source lives in the CVH monorepo under python-client/. File issues at hms-dbmi/cvh/issues.

Installation

Requires Python 3.13+.

pip install cvh-client

With Vitessce widget support:

pip install "cvh-client[vitessce]"

Quick start

from cvh_client import CVHClient

# Authenticate against the hosted CVH via Auth0 (opens a browser
# for the device-authorization flow). Swap `base_url`, `domain`,
# `client_id`, and `audience` for your own deployment's values if
# you're self-hosting.
client = CVHClient.from_login(
    base_url="https://api.visualizationhub.org",
    domain="auth.visualizationhub.org",
    client_id="BlOrQcABtV8FrluOQnIO3bWCG1MQU9bx",
    audience="cvh-api-prod-id",
)

# List workspaces
workspaces = client.list_workspaces()
ws = workspaces.items[0]

# List datasets and visualizations in a workspace
datasets = client.list_datasets(ws.uuid)
visualizations = client.list_visualizations(ws.uuid)

# Get a single visualization with its config
viz = client.get_visualization(visualizations[0].uuid)

# Update a visualization
client.update_visualization(viz.uuid, name="New name", conf={...})

Token expiration is handled automatically — if the client was created via from_login(), it will re-authenticate when the token expires.

API methods

Workspaces

Method Description
list_workspaces(limit, offset) List workspaces the user has access to
get_workspace(uuid) Get a single workspace

Datasets

Method Description
list_datasets(workspace_uuid, *, tags, assembly, file_type, name, page, page_size) List datasets in a workspace with optional filters
get_dataset(uuid) Get a single dataset
update_dataset(uuid, **fields) Update dataset metadata

Visualizations

Method Description
create_visualization(workspace_uuid, name, *, description, author, tool) Create a new visualization
list_visualizations(workspace_uuid, *, tags, name) List visualizations in a workspace
get_visualization(uuid) Get a visualization with its full config
update_visualization(uuid, **fields) Update visualization metadata or config

All methods return typed Pydantic models (Workspace, Dataset, Visualization, etc.).

Error handling

API errors raise descriptive exceptions:

from cvh_client import NotFoundError, AuthorizationError, CVHAPIError

try:
    client.get_visualization("nonexistent-uuid")
except NotFoundError as e:
    print(e.status_code)  # 404
    print(e.detail)       # {"detail": "..."}
except AuthorizationError:
    print("Check your permissions")
except CVHAPIError as e:
    print(f"API error {e.status_code}: {e}")

Examples

See the examples/ directory for Jupyter notebooks:

  • getting_started.ipynb — Authentication, listing workspaces/datasets/visualizations, basic CRUD
  • vitessce_workflow.ipynb — End-to-end Vitessce workflow: create a visualization with the Codeluppi et al. osmFISH config, retrieve it, view it with the Vitessce widget, modify and update

Development

Run these from inside python-client/ (checkout the monorepo first).

uv sync                                # Install dependencies
uv run pytest                          # Run tests
uv run ruff check src/ tests/          # Lint
uv run ruff format src/ tests/         # Format

Releasing

Published to PyPI via manual GitHub Actions dispatch. To cut a release:

  1. Bump the version in VERSION.txt, pyproject.toml and src/cvh_client/__init__.py (the workflow refuses to publish if they differ), and move the [Unreleased] changelog entries under the new version.
  2. Merge to main.
  3. In the CVH repo's Actions tab → Publish cvh-client → Run workflow, entering the same version string as confirmation. Choose testpypi first to rehearse the release on TestPyPI, then run it again with pypi.

PyPI never accepts the same version twice, so a mistake can't be fixed by re-uploading; it needs a new version. That's what the TestPyPI rehearsal is for.

After publishing, the workflow installs the new version and smoke-tests it against the matching backend (dev for TestPyPI, production for PyPI).

The workflow uses trusted publishing (OIDC — no long-lived token). Trust is configured on each index as:

  • Repository: hms-dbmi/cvh
  • Workflow: publish-client.yml
  • Environment: testpypi on TestPyPI, pypi on PyPI

Metadata

Release files for cvh-client 0.3.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 cvh-client 0.3.0
File Size Uploaded
cvh_client-0.3.0.tar.gz 13.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cvh-client 0.3.0
File Interpreter ABI Platform
cvh_client-0.3.0-py3-none-any.whl Python 3 none any Details

Total release size: 29.8 kB

Release files / cvh_client-0.3.0.tar.gz

Download URL cvh_client-0.3.0.tar.gz
Size 13.6 kB
Tags Source
SHA-256 checksum
How to use checksums
c6f4b816e36f955a85cd8df7caac9de7c74bfa69369bda2b7e3caaf1247fcc12
BLAKE2b-256 checksum
How to use checksums
39c564937adb82c93c405a57232aa85a3fe1a743da52cb494a7b9bf443e78ee0
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 Oct 9, 2026.

Transparency log

Release files / cvh_client-0.3.0-py3-none-any.whl

Download URL cvh_client-0.3.0-py3-none-any.whl
Size 16.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c5b124de6ad5d8675dc61bff4a75d41f5719b53e275cf0fc03f9c36bada030a
BLAKE2b-256 checksum
How to use checksums
111413ca9b549390e4ffa3726dfb5e270527fcca8b6bec3e72c71e2b7da801d2
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 Oct 9, 2026.

Transparency log

Release history Release notifications | RSS feed

0.4.1

2 release files

0.4.0

2 release files

This release

0.3.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