Skip to main content

Build agent-native Python CLIs with progressive discovery

Project description

pypith

Decorator-based library for building agent-native Python CLIs with progressive discovery.

  • Define commands with @app.command() and attach intents and hints
  • Auto-generated pith discovery subcommand with tiers 0-3
  • Built-in core schema, rendering, and optional semantic search
  • Schema export compatible with pypith-cli

Installation

pip install pypith

# With semantic search support
pip install pypith[semantic]

Quick Start

from pith import Pith, Argument, Option
from pathlib import Path

app = Pith(name="fileops", pith="File manipulation utilities")

@app.command()
@app.intents("copy files", "duplicate", "backup files")
def copy(
    src: Path = Argument(..., pith="Source file or directory"),
    dest: Path = Argument(..., pith="Destination path"),
    recursive: bool = Option(False, "-r", "--recursive", pith="Copy directories recursively"),
):
    """Copy files or directories to a destination."""
    import shutil
    if src.is_dir() and recursive:
        shutil.copytree(src, dest)
    else:
        shutil.copy2(src, dest)

if __name__ == "__main__":
    app.run()

Core Module

The library includes the core schema and rendering utilities:

from pith.core import PithSchema, Command, Tier1, Tier2, Tier3
from pith.core import render_tier0, build_run_line, search_commands

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypith-0.1.0-py3-none-any.whl (20.9 kB view details)

Uploaded Python 3

File details

Details for the file pypith-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: pypith-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 20.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypith-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df27b604305a12adc795bbbc7dbec025e4fbb7a4847ac96edacee7d6c1d73c93
MD5 aa75524a6b0fd83a630127461f87209a
BLAKE2b-256 2df80da7059fc445fb3ff8fc5656c14b55bebe6768bee974423103fc5c793a96

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypith-0.1.0-py3-none-any.whl:

Publisher: release.yml on ThomasRohde/pith

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page