• Stars
    star
    195
  • Rank 199,374 (Top 4 %)
  • Language
    Python
  • License
    Apache License 2.0
  • Created over 7 years ago
  • Updated almost 6 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

function as a service

Firefly

Build Status

Function as a service.

How to install?

Install firefly from source using:

pip install firefly-python

How to use?

Create a simple python function.

# fib.py

def fib(n):
	if n == 0 or n == 1:
		return 1
	else:
		return fib(n-1) + fib(n-2)

And run it using firefly.

$ firefly fib.fib
http://127.0.0.1:8000/
...

That started the fib function as a service listening at http://127.0.0.1:8000/.

Let us see how to use it with a client.

>>> import firefly
>>> client = firefly.Client("http://127.0.0.1:8000/")
>>> client.fib(n=10)
89

The service can also be invoked by sending a POST request.

$ curl -d '{"n": 10}' http://127.0.0.1:8000/fib
89

Documentation

http://firefly-python.readthedocs.io/

Features Planned

  • Auto reload
  • supporting other input and output content-types in addition to json. (for example, a function to resize an image)
  • serverless deployment