Targon sdk to interacte with the targon rentals and serverless
Project description
Targon SDK
Modal-style Python SDK for deploying serverless functions to Targon.
Installation
cd targon-sdk
pip install -e .
Quick Start
- Setup credentials:
targon setup
# Enter your API key when prompted
- Create 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
Examples
Simple Web Server
import targon
import subprocess
app = targon.App("web-server")
@app.function()
@targon.web_server(port=8000)
def serve():
subprocess.Popen("python -m http.server 8000", shell=True)
vLLM Inference Server
See examples/vllm_qwen.py for a complete example of deploying vLLM with Qwen models.
targon deploy examples/vllm_qwen.py
Architecture
- targon-sdk: Python client library (this directory)
- heim: Image builder + container registry
- tha: Serverless backend (Knative)
API Reference
targon.App(name)
Create a new application.
@app.function(image=None, gpu=None, cpu=None, memory=None, timeout=300)
Decorator to register a function with the app.
@targon.web_server(port, startup_timeout=5.0)
Decorator for functions that start a web server process.
@targon.fastapi_endpoint(method="GET")
Decorator for FastAPI-style HTTP endpoints.
CLI Commands
targon deploy <file.py>- Deploy an apptargon list- List deploymentstargon logs <uid>- View function logstargon setup- Configure API credentials
Development
The SDK follows Modal's design patterns:
- Decorator-based function registration
- Cloudpickle serialization for function transport
- Image building with Dockerfile generation
- Container registry integration
- Knative deployment backend
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file targon_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: targon_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 75.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d387048664add1473d0477612125a65382f116ebd49e8992c59b5a1ed606739c
|
|
| MD5 |
5855b8d90edb136351db54a7add235ad
|
|
| BLAKE2b-256 |
785219bbfc149aae512e89030512f5ba422ceb2fd0ee415124a3b3a7b9001ebd
|