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.2.tar.gz (18.0 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.2-py3-none-any.whl (24.0 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pypith-0.1.2.tar.gz
  • Upload date:
  • Size: 18.0 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.2.tar.gz
Algorithm Hash digest
SHA256 b5efef8c892fcd5e2c9a636ca0466d93ec6916b51343637bfa0bf6bbbb5050ff
MD5 e72c646390b63b06990d685daaa0bd81
BLAKE2b-256 ba7f52661763779b8b2e0cf99da6db20b7b17497db91110a715774e072d37017

See more details on using hashes here.

Provenance

The following attestation bundles were made for pypith-0.1.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: pypith-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 24.0 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 37693e9f6c354bbbe4e769e10fb727e19bdc45eaf031b7459ea4dfbd4562fdb5
MD5 6b6c36c8cd37126faf8ceaa60f09ac2b
BLAKE2b-256 ad98ef2ba7a55a28e2239b973a6ae16d4685769d73013bba497b30f85e6b6ab4

See more details on using hashes here.

Provenance

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