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 Distribution

pypith-0.1.1.tar.gz (15.2 kB view details)

Uploaded Source

Built Distribution

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

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

Uploaded Python 3

File details

Details for the file pypith-0.1.1.tar.gz.

File metadata

  • Download URL: pypith-0.1.1.tar.gz
  • Upload date:
  • Size: 15.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pypith-0.1.1.tar.gz
Algorithm Hash digest
SHA256 dd3ae6477f3ae70b9a4032d4165f8f6eb7f89a41e2ac775fe74b9766c2a82c2d
MD5 df7a01d58218ed2cacd66789930268e9
BLAKE2b-256 d4f6e97394d99c97e36341349a01504e2edc947832bab8490dca6ed051571956

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypith-0.1.1.tar.gz:

Publisher: release.yml on ThomasRohde/pith

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

File details

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

File metadata

  • Download URL: pypith-0.1.1-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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e7216471ec7e64cb97fc93f3b7fe1446394376529bb796fe326752084029b3ba
MD5 19d013f2479ad9b715732ad1fdb0a557
BLAKE2b-256 5e558894c252084fda14809a3dc3153e378d5e349029da24111065bb93a9092f

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypith-0.1.1-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