Catalog PyPI
Back to packageRELEASE DETAILS

0.7.0

PyPI

agraffe

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

Published12 Mar 2023
Direct dependencies11
Transitive dependenciesNot calculated

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.

Declared dependencies 16

Native requirements
11 direct targetsNot calculated transitive count
Package / targetRequirementRelationship
typing-extensions
Environment
{
  "extras": "",
  "marker": null,
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
typing-extensions >=4.0.0, <5.0.0runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
mypy ==0.931 ; extra == "dev"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
flake8 >=4.0.1, <5.0.0 ; extra == "dev"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
black ==22.3.0 ; extra == "dev"runtime
isort
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
isort >=5.10.1, <6.0.0 ; extra == "dev"runtime
azure-functions
Environment
{
  "extras": "",
  "marker": "extra == \"dev\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
azure-functions >=1.5.0, <2.0 ; extra == "dev"runtime
pytest
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
pytest >=7.2.1, <8.0.0 ; extra == "test"runtime
mypy
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
mypy ==0.931 ; extra == "test"runtime
flake8
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
flake8 >=4.0.1, <5.0.0 ; extra == "test"runtime
black
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
black ==22.3.0 ; extra == "test"runtime
isort
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
isort >=5.10.1, <6.0.0 ; extra == "test"runtime
azure-functions
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
azure-functions >=1.5.0, <2.0 ; extra == "test"runtime
functions-framework
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
functions-framework ==3.0.0 ; extra == "test"runtime
fastapi
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
fastapi >=0.94.0 ; extra == "test"runtime
pydantic
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
pydantic >=1.10.4 ; extra == "test"runtime
python-multipart
Environment
{
  "extras": "",
  "marker": "extra == \"test\"",
  "requires_python": ">=3.7",
  "evaluation": "NOT_EVALUATED"
}
python-multipart >=0.0.5 ; extra == "test"runtime

Distribution files

2 collected
agraffe-0.7.0-py3-none-any.whl

bdist_wheel · 8.64 KB · Python py3

Source file
agraffe-0.7.0.tar.gz

sdist · 51.12 KB · Python source

Source file

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_version:4c192b357f3af978b1d903e9d2da4795a9ea92bc17cbcd13ed563314a2c93eaf

Other collected versions

View all collected versions →