Turn Python functions into CLI commands and HTTP endpoints instantly.
pip install dogudaCreate 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 + bEnsure 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: 5doguda listOutput:
📦 MyCommands
• hello(name: str)
Say hello to someone.
• add(a: int, b: int)
Add two numbers.
Start a FastAPI server with your commands as endpoints:
doguda serve --host 0.0.0.0 --port 8000Then call your functions via HTTP:
curl -X POST http://localhost:8000/v1/doguda/hello \
-H "Content-Type: application/json" \
-d '{"name": "Doguda"}'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 nameWhen running doguda list, these will appear unified under 📦 Backend.
| Variable | Description | Default |
|---|---|---|
DOGUDA_PATH |
Path to search for modules | Current directory |
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")MIT License - see LICENSE for details.