Skip to main content

wt-registry

codecov

Explicit function registry with JSON schema generation for Python.

Overview

wt-registry provides a simple, explicit decorator-based approach to registering functions with rich metadata and automatic JSON schema generation using Pydantic.

Features

  • Explicit Registration: Use @register decorator with metadata (title, description, tags)
  • Type Safety: Requires complete type annotations for all registered functions
  • JSON Schema Generation: Automatically generates JSON schemas using Pydantic TypeAdapter
  • Minimal Dependencies: Only requires Python 3.10+ and Pydantic
  • CLI Tool: Export registry contents as JSON via command-line interface
  • Fully Serializable: Registry stores metadata and schemas, not function objects

Quick Start with Examples

The fastest way to see wt-registry in action:

# Clone the repository
git clone https://github.com/USERNAME/wt-registry.git
cd wt-registry

# One-time setup
uv sync

# Run an example
uv run python examples/basic_registration.py

See examples/README.md for more examples demonstrating:

  • Basic function registration
  • JSON and pretty output formats
  • Function filtering
  • Deprecated function handling
  • Multi-module scenarios

Installation

uv pip install wt-registry

Quick Start

from wt_registry import register, get_registry

@register(
    title="Calculate Statistics",
    description="Calculate mean, median, and stdev of numeric values",
    tags=["statistics", "analysis"]
)
def calculate_statistics(
    values: list[float],
    precision: int = 2
) -> dict[str, float]:
    import statistics
    return {
        "mean": round(statistics.mean(values), precision),
        "median": round(statistics.median(values), precision),
        "stdev": round(statistics.stdev(values), precision) if len(values) > 1 else 0.0,
    }

# Access the registry
registry = get_registry()
for fqn, entry in registry.items():
    print(f"{entry.metadata.title}: {fqn}")
    print(f"  Schema: {entry.json_schema}")

CLI Usage

Export the entire registry as JSON:

wt-registry > registry.json

Filter by tags:

wt-registry --filter-tag statistics --format pretty

Filter by module:

wt-registry --module "myapp.tasks.*"

Requirements

  • Python 3.10+
  • Pydantic 2.0+

Development

Install development dependencies:

# IMPORTANT: Use --group dev (not --extra dev) with dependency-groups
uv sync --group dev

Note: This project uses [dependency-groups] instead of [project.optional-dependencies]. You must use --group dev to install dev dependencies (pytest, mypy, ruff, etc.). Running uv sync alone will not install dev dependencies.

Set up pre-commit hooks (automatically runs ruff linting and formatting on every commit):

uv run pre-commit install

Run tests:

uv run pytest

Run type checking:

uv run mypy src/wt_registry

License

BSD-3-Clause

Metadata

Release files for wt-registry 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 wt-registry 0.3.0
File Size Uploaded Provenance Actions
wt_registry-0.3.0.tar.gz 103.8 kB Without provenance Details for wt_registry-0.3.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for wt-registry 0.3.0
File Interpreter ABI Platform Actions
wt_registry-0.3.0-py3-none-any.whl Python 3 none any Details for wt_registry-0.3.0-py3-none-any.whl

Total release size: 121.2 kB

Release files / wt_registry-0.3.0.tar.gz

Download URL wt_registry-0.3.0.tar.gz
Size 103.8 kB
Tags Source
SHA-256 checksum
How to use checksums
40144a432986d7bea6410b6fcedc21dd3c8bbde3cc5275623b7a096769b2caa8
BLAKE2b-256 checksum
How to use checksums
62b5172e46185c51f80ef26ce4a467f512fb37d8452e221f85fd2642912c5237
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

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

Download URL wt_registry-0.3.0-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9ffe91ef5ea446a5b503b6ed8e91c0fea86fa0d0287d9736b9ad7cb341b7dfdc
BLAKE2b-256 checksum
How to use checksums
8b79e960f4356bace9b8487db6bba0bc04aff81ae496dbc0dda8146952cfd385
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.7 {"installer":{"name":"uv","version":"0.13.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for wt-registry 0.3.0

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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