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.5.tar.gz (10.1 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.5-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: doguda-0.1.5.tar.gz
  • Upload date:
  • Size: 10.1 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.5.tar.gz
Algorithm Hash digest
SHA256 118dbaa878a2e9563d0823e4a335a79f710d82e4aaad76ac4de0bd07913306e1
MD5 6ab4d03cd386ccbebf7052507c53dd77
BLAKE2b-256 364b8f6c8d1f26dfd7e45cc57623d6aa7604e777a1fd95ab486092f6c6b89883

See more details on using hashes here.

File details

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

File metadata

  • Download URL: doguda-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.6 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.5-py3-none-any.whl
Algorithm Hash digest
SHA256 d17a4eace1c7f6a6aa963ea7289e617570aae93e5743b06b3f95c91a821ef4c7
MD5 9af9881ebcbd4fc8cfc62888d7137367
BLAKE2b-256 60d8ff7d21844005aa2a4d6892b89f2bbc18855e02dac08ff613afcdf3223ac9

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