Skip to main content

dspy-hub

dspy-hub is the official CLI and Python SDK for browsing, installing, and publishing DSPy programs. It speaks the same registry format used by dspyhub.com and ships with a sample registry so you can try the tooling without any external services.

Installation

pip install dspy-hub
# or with uv
uv pip install dspy-hub

For local development against this repository:

uv pip install -e .

CLI quick start

The CLI exposes two primary commands: list to browse packages and install to copy package artifacts into a local directory.

dspy-hub list
dspy-hub list --long
dspy-hub install dspy-team/people-extractor --dest ./dspy_packages
  • Packages are addressed as <author>/<name>.
  • By default the CLI talks to https://api.dspyhub.com/index.json.
  • Override the registry with --registry or by passing a custom URL directly to the SDK helpers.

Both CLI and SDK share that default. Point them at dspy_hub/sample_registry/index.json if you want to explore the bundled sample manifest offline.

Python SDK quick start

Import dspy_hub anywhere you need to automate interactions with a registry.

import dspy_hub

# Load a published program straight into a DSPy module
program = dspy_hub.load_program_from_hub("dspy-team/people-extractor")

# Inspect raw manifests or file payloads
package = dspy_hub.load_from_hub("dspy-team/people-extractor")
print(package.metadata)

Publishing from Python

Publishing requires a developer key provided by the registry operator. Supply it via the DSPY_HUB_DEV_KEY environment variable or the dev_key argument.

metadata = {
    "version": "0.1.0",
    "description": "Optimized DSPy program that extracts people names.",
    "tags": ["example", "demo"],
}
dspy_hub.save_program_to_hub(
    "people-extractor",
    my_program,
    metadata,
    registry="https://example.com",
)

Need to bundle local helper modules? Pass them via modules_to_serialize, e.g. modules_to_serialize=[my_helpers].

The identifier should be the package name only when publishing ("people-extractor"); the hub derives the author namespace from the developer key.

Environment variables

Variable Purpose
DSPY_HUB_DEV_KEY Developer key required for authenticated publishing workflows.

Bundled sample registry

The package includes a miniature registry under dspy_hub/sample_registry/. Point the CLI or SDK to it (or leave the defaults) to explore the package format without standing up a server. The sample contains:

  • index.json: manifest of available packages.
  • packages/<author>/<name>/...: artifact payloads referenced by the manifest.

Troubleshooting

  • Use --dry-run with the install command to preview which files would be written.
  • Run with -h or --help to see full CLI usage.
  • When diagnosing registry issues, ensure the manifest exposes SHA-256 hashes for each file; the installer validates them before writing.

Metadata

Release files for dspy-hub 0.1.4

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

Source distribution (sdist)

Source distribution for dspy-hub 0.1.4
File Size Uploaded
dspy_hub-0.1.4.tar.gz 18.2 kB Details

Release files / dspy_hub-0.1.4.tar.gz

Download URL dspy_hub-0.1.4.tar.gz
Size 18.2 kB
Tags Source
SHA-256 checksum
How to use checksums
099c70293b4e6964553e3e2d05d5018ed71c0939984c27a67d96226d2e88d77f
BLAKE2b-256 checksum
How to use checksums
95c495b9413534adc0f6b8b8e78454827f672a378deb6963c77eccb743ffc2a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.5.26

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.3

1 release file

0.1.2

1 release file

0.1.1

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