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

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.1
File Size Uploaded Provenance Actions
wt_registry-0.3.1.tar.gz 104.2 kB Without provenance Details for wt_registry-0.3.1.tar.gz

Built distribution (wheel)

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

Total release size: 121.6 kB

Release files / wt_registry-0.3.1.tar.gz

Download URL wt_registry-0.3.1.tar.gz
Size 104.2 kB
Tags Source
SHA-256 checksum
How to use checksums
6277853e741bd595289b36f0476974e053e6fffb084dca665d002b9bf87d01a9
BLAKE2b-256 checksum
How to use checksums
cfd12cb8680ce808a22729703f7fcbba9fa31bfa15077e2f07bac2bb38bad0b1
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.1-py3-none-any.whl

Download URL wt_registry-0.3.1-py3-none-any.whl
Size 17.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
12bac6ed4510035dddfcf5340a37218ae6abd06505de75441a855a2f2cf6862d
BLAKE2b-256 checksum
How to use checksums
d4534688f129bd246f6562949e78c234155960588289b8a190943bf51ed59108
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.1

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