PEPhub Client Library

0.5.1 · active · verified Thu Apr 16

The `pephubclient` is a Python client library for interacting with PEPhub, a web-based platform for managing Portable Encapsulated Projects (PEPs). It provides an interface to access, create, and manage PEPs programmatically, wrapping the PEPhub REST API. The current version is 0.5.1, with a release cadence that generally follows new features and bug fixes for the PEPhub platform itself.

Common errors

Warnings

Install

Imports

Quickstart

Initializes the PEPhub client and attempts to retrieve a public project. For private projects or authenticated actions, you would typically log in using an API key (e.g., from the `PH_KEY` environment variable).

import os
from pephubclient import PEPHubClient

# Initialize the client. The default host is https://pephub.databio.org
phc = PEPHubClient()

# Retrieve a publicly accessible project from PEPhub.
# 'test/test_project:test' is a common example project for testing.
try:
    project = phc.get_project(namespace='test', name='test_project', tag='test')
    print(f"Successfully retrieved project: {project.name}")
    print(f"Project description: {project.description}")
    print(f"Number of samples: {len(project.samples)}")
except Exception as e:
    print(f"Error retrieving project 'test/test_project:test': {e}")
    print("This project might not exist or might require authentication. ")
    print("For private projects, set the PH_KEY environment variable and ")
    print("then call `phc.login(api_key=os.environ.get('PH_KEY'))` before fetching.")

view raw JSON →