Catalog PyPI
PACKAGE EXPLORERView in registry

agraffe

PyPI

Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).

Versions collected1
Direct dependencies11From release 0.7.0
Last observed21 Oct, 09:25 UTC

README

Version 0.7.0 documentation

icon

PyPI version Test

Agraffe, build API with ASGI in Serverless services (e.g AWS lambda, Google Cloud Functions and Azure Functions).

Support Services

  • Google Cloud Functions
    • Python 3.7, 3.8, 3.9, 3.10, 3.11(preview)
  • AWS lambda (with API Gateway HTTP API or REST API, or with Function URL)
    • Python 3.7, 3.8, 3.9
  • Azure Functions
    • Python 3.7, 3.8, 3.9, 3.10(preview)

Requirements

Python 3.7+

Installation

$ pip install agraffe

Example

Create it

  • Create a file main.py with:
import contextlib

from agraffe import Agraffe
from fastapi import FastAPI, Request


@contextlib.asynccontextmanager
async def lifespan(app):
    yield {'message': 'hello'}

app = FastAPI(lifespan=lifespan)


@app.get("/")
def read_root():
    return {"Hello": "World"}


@app.get("/items/{item_id}")
def read_item(item_id: int, q: str | None = None):
    return {"item_id": item_id, "q": q}


@app.get("/lifespan")
def lifespan_(request: Request):
    return {"count": request.state.message}


entry_point = Agraffe.entry_point(app)
# or, for on GCP
from agraffe.services.google_cloud_functions import HttpCycle

def entry_point(request):
    return Agraffe(app, HttpCycle)(request=request)

Deploy it

  • Deploy the api with:
$ gcloud functions deploy {FUNCTION NAME} --entry-point entry_point --runtime python310 --trigger-http --allow-unauthenticated

See /example for other services.

License

This project is licensed under the terms of the MIT license.

Downloads & popularity

Awaiting observations

No metric observations yet

Download counts and popularity will appear here as the collector receives them.

Versions 1

Collected releases
VersionPublishedDirect dependenciesOpen version
0.7.012 Mar 202311

Package advisories

0
No matching advisories collected

This describes our collected data; it is not a security assessment.

Repository

PENDING
odd12258053/agraffe

Shared repository data · GitHub

License detected in repository
Not collected

Metadata history

Meaningful changes
Current collected state Current

Observed since 21 Oct, 09:25 UTC

No superseded metadata states collected. Unchanged observations do not create new revisions.

Record identity

package:fe48c1cf0b7e0ee5a69115ef95b5037a61a1a8d9aa84b586919f1867dbe99884