Skip to main content

Turn Python functions into CLI commands and HTTP endpoints instantly

Project description

Doguda

Turn Python functions into CLI commands and HTTP endpoints instantly.

PyPI version Python 3.10+ License: MIT

Installation

pip install doguda

Quick Start

Create a file (e.g., my_commands.py):

from doguda import DogudaApp

app = DogudaApp("MyCommands")

@app.command
def hello(name: str = "World") -> str:
    """Say hello to someone."""
    return f"Hello, {name}!"

@app.command
async def add(a: int, b: int) -> int:
    """Add two numbers."""
    return a + b

CLI Usage

Ensure your module is in the current directory or DOGUDA_PATH.

Run commands directly from the command line:

# Execute a command (automatically discovered)
doguda exec hello --name "Doguda"
# Output: Hello, Doguda!

doguda exec add --a 2 --b 3
# Output: 5

List Available Commands

doguda list

Output:

📦 MyCommands
  • hello(name: str)
      Say hello to someone.
  • add(a: int, b: int)
      Add two numbers.

HTTP Server

Start a FastAPI server with your commands as endpoints:

doguda serve --host 0.0.0.0 --port 8000

Then call your functions via HTTP:

curl -X POST http://localhost:8000/v1/doguda/hello \
  -H "Content-Type: application/json" \
  -d '{"name": "Doguda"}'

Organizing Commands

You can split your commands across multiple files. Valid DogudaApp instances with the same name will be automatically merged into a single logical app in the CLI.

# users.py
app = DogudaApp("Backend") # Same name

# reports.py
app = DogudaApp("Backend") # Same name

When running doguda list, these will appear unified under 📦 Backend.

Environment Variables

Variable Description Default
DOGUDA_PATH Path to search for modules Current directory

Response Models

Use Pydantic models for structured responses:

from pydantic import BaseModel
from doguda import DogudaApp

app = DogudaApp()

class UserResponse(BaseModel):
    id: int
    name: str
    email: str

@app.command
def get_user(user_id: int) -> UserResponse:
    """Get user by ID."""
    return UserResponse(id=user_id, name="John", email="john@example.com")

License

MIT License - see LICENSE for details.

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

doguda-0.1.7.tar.gz (11.8 kB view details)

Uploaded Source

Built Distribution

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

doguda-0.1.7-py3-none-any.whl (11.3 kB view details)

Uploaded Python 3

File details

Details for the file doguda-0.1.7.tar.gz.

File metadata

  • Download URL: doguda-0.1.7.tar.gz
  • Upload date:
  • Size: 11.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for doguda-0.1.7.tar.gz
Algorithm Hash digest
SHA256 4ec027fef1fa1883b60b6f37e56c16ae47da0b088aaf9fd00553bda8913bd710
MD5 d43c99e77da52ad4c313303efcb95413
BLAKE2b-256 35ed04057ebabc66ff4feef5c77cb2e1d1769f423827339f3fa9ce9b6fdf5d5c

See more details on using hashes here.

File details

Details for the file doguda-0.1.7-py3-none-any.whl.

File metadata

  • Download URL: doguda-0.1.7-py3-none-any.whl
  • Upload date:
  • Size: 11.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.15 {"installer":{"name":"uv","version":"0.9.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for doguda-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 e34c8febf88be5d3e734748a43f44b4848bf52703e4e8b0c4f2591441246fcef
MD5 fe010dbb06d32d78df463eb7aa68d7e2
BLAKE2b-256 184c3ac239daedbba3c04e64f0b3881e2ab1bba9441c6097cbef3b6b493bf269

See more details on using hashes here.

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