https://github.com/junah201/vellox
GCP Cloud Functions support for ASGI applications
https://github.com/junah201/vellox
gcp gcp-cloud-functions python serverless
Last synced: 16 days ago
JSON representation
GCP Cloud Functions support for ASGI applications
- Host: GitHub
- URL: https://github.com/junah201/vellox
- Owner: junah201
- License: mit
- Created: 2024-04-10T16:57:53.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2026-03-03T06:14:35.000Z (about 1 month ago)
- Last Synced: 2026-03-03T06:42:39.470Z (about 1 month ago)
- Topics: gcp, gcp-cloud-functions, python, serverless
- Language: Python
- Homepage: https://vellox.junah.dev
- Size: 2.39 MB
- Stars: 26
- Watchers: 0
- Forks: 2
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Contributing: docs/contributing.md
- License: LICENSE
Awesome Lists containing this project
- awesome-starlette - Vellox - Serverless ASGI adapter for Google Cloud Functions. (Extensions / Deployment / Serverless)
README
# Vellox
Vellox is an adapter for running [ASGI](https://asgi.readthedocs.io/en/latest) applications in GCP Cloud Functions.
## Requirements
Python 3.8+
## Installation
```bash
pip install vellox
```
## Example
```python
from vellox import Vellox
async def app(scope, receive, send):
await send(
{
"type": "http.response.start",
"status": 200,
"headers": [[b"content-type", b"text/plain; charset=utf-8"]],
}
)
await send({"type": "http.response.body", "body": b"Hello, world!"})
vellox = Vellox(app=app, lifespan="off")
def handler(request):
return vellox(request)
```
Or using a framework:
```python
from fastapi import FastAPI
from vellox import Vellox
app = FastAPI()
@app.get("/")
def read_root():
return {"Hello": "World"}
@app.get("/items/{item_id}")
def read_item(item_id: int, q: str = None):
return {"item_id": item_id, "q": q}
vellox = Vellox(app=app, lifespan="off")
def handler(request):
return vellox(request)
```