Python SDK for building and deploying serverless applications on the Targon platform. It includes the command-line client, decorator-friendly runtime APIs, and publishing utilities.
- Python 3.9+
- Targon account with API access
- Optional: Docker (for advanced image customization)
pip install targon-sdkgit clone https://github.com/manifold-inc/targon-sdk.git
cd targon-sdk
pip install -e .-
Configure credentials
targon setup # Follow the prompts to store your API key securely -
Define an app
# my_app.py import targon import subprocess app = targon.App("my-first-app") @app.function() @targon.web_server(port=8000) def serve(): subprocess.Popen("python -m http.server 8000", shell=True) @app.local_entrypoint() def main(): print("Hello from Targon!")
-
Deploy
targon deploy my_app.py
-
Iterate locally
targon run my_app.py --message "hello"
| Command | Description |
|---|---|
targon setup |
Store or update API credentials. |
targon deploy <file.py> |
Build and deploy an app module. |
targon run <file.py> |
Execute a local entrypoint in an ephemeral session. |
targon app list |
List deployed/running apps. |
targon app functions <app_id> |
Inspect functions for a given app. |
targon app delete <app_id> |
Delete an app and its deployments. |
Visit examples/ for ready-to-run templates:
gettin_started/getting_started.py– minimal hello world workflow.gettin_started/web_endpoint_simple.py– FastAPI endpoint via@targon.fastapi_endpoint.web/web_endpoint_asgi.py– full ASGI application deployment.llm/vllm_example.py– vLLM inference service running behind@targon.web_server.gen-ai/– generated media workloads.
Deploy an example directly:
targon deploy examples/gettin_started/getting_started.py- The SDK mirrors common serverless-style patterns: decorator-based registration, cloudpickle serialization, and runtime-provisioned images.
- Core packages used at runtime:
cloudpicklefor function transportgrpcio/grpcio-toolsfor RPC communicationaiohttpfor async HTTP interactions
- Tests live under
tests/. Run them withpytest(optional dependency). - When contributing protocol changes, regenerate stubs with the matching
grpcio-toolsversion to avoid runtime mismatches.
Open an issue or reach out to dev@manifold.inc for questions, feature requests, or bug reports. Contributions are welcome!