Skip to main content

No project description provided

Project description

Pyfunvice is FaaS SDK for Python

If you want to write an HTTP service based on python, your service is very simple, and at the same time you don’t want to add a complicated HTTP framework, Pyfunvice will be your best choice.

First, you need to install pyfunvice

pip install pyfunvice

And a very simple example will be provided below

from pyfunvice import faas, faas_with_dict_req, start_faas

@faas(path="/api/v1/greet")
async def v1_greet(data: dict) -> dict:
    name = data["name"]
    age = data["age"]
    return {"name": name, "age": age, "status": "success"}

if __name__ == "__main__":
    start_faas()

That's all, a HTTP service will be run and the default port is 8000 and the path is /api/v1/greet

If you want to change the default port, you can add port parameter

from pyfunvice import faas, faas_with_dict_req, start_faas

@faas(path="/api/v1/greet")
async def v1_greet(data: dict) -> dict:
    name = data["name"]
    age = data["age"]
    return {"name": name, "age": age, "status": "success"}

if __name__ == "__main__":
    start_faas(port=8080)

And if you want to increase the number of workers, you can add workers parameter, it will run n worker processes in parallel

from pyfunvice import faas, faas_with_dict_req, start_faas

@faas(path="/api/v1/greet")
async def v1_greet(data: dict) -> dict:
    name = data["name"]
    age = data["age"]
    return {"name": name, "age": age, "status": "success"}

if __name__ == "__main__":
    start_faas(port=8080, workers=2)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyfunvice-0.1.12.tar.gz (4.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyfunvice-0.1.12-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file pyfunvice-0.1.12.tar.gz.

File metadata

  • Download URL: pyfunvice-0.1.12.tar.gz
  • Upload date:
  • Size: 4.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/4.18.0-408.el8.x86_64

File hashes

Hashes for pyfunvice-0.1.12.tar.gz
Algorithm Hash digest
SHA256 fb76a7bdbff5bc0f70c935bae3354015f155d85c4a818d59ba79586fa5eacac2
MD5 3e503528e700ee4fb8449c29d33c8e16
BLAKE2b-256 74176fa54ae7c3c743d9a999659eb2a25943469ad9202c855518599d4a744c9a

See more details on using hashes here.

File details

Details for the file pyfunvice-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: pyfunvice-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.2 CPython/3.11.8 Linux/4.18.0-408.el8.x86_64

File hashes

Hashes for pyfunvice-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 ab56ed09267f8b14a30fb887d571b09f8d086e1a0f9a09840605c93852dcc705
MD5 696714262ca7126581d6d21d19e4e3cb
BLAKE2b-256 769e529e92234716862720cbdc23570d13a7263b915ed1eee5b1fcd6a6a3bae1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page