-
Notifications
You must be signed in to change notification settings - Fork 30
/
setup.py
102 lines (75 loc) · 1.95 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
"""
Firefly
-------
Firefly is a tool to expose Python functions as RESTful APIs.
Install
~~~~~~~
It can be installed using pip.
..code:: bash
$ pip install firefly-python
Usage
~~~~~
Write a python function:
..code:: python
# sq.py
def square(n):
return n*n
And run it with firefly:
..code:: bash
$ firefly sq.square
[2017-06-08 12:45:11 +0530] [20237] [INFO] Starting gunicorn 19.7.1
[2017-06-08 12:45:11 +0530] [20237] [INFO] Listening at: http://127.0.0.1:8000 (20237)
...
Firefly provides a simple client interface to interact with the server.
..code:: python
>>> from firefly.client import Client
>>> client = Client("http://127.0.0.1:8000")
>>> client.square(n=4)
16
Or, you can use the API directly:
..code:: bash
$ curl -d '{"n": 4}' http://127.0.0.1:8000/square
16
Links
~~~~~
* `Documentation <https://firefly-python.readthedocs.io/>`_
* `Github <https://github.com/rorodata/firefly>`_
"""
from setuptools import setup, find_packages
import os.path
import sys
PY2 = (sys.version_info.major == 2)
def get_version():
"""Returns the package version taken from version.py.
"""
root = os.path.dirname(__file__)
version_path = os.path.join(root, "firefly/version.py")
with open(version_path) as f:
code = f.read()
env = {}
exec(code, env, env)
return env['__version__']
install_requires = [
'gunicorn>=19.7.1',
'WebOb>=1.7.2',
'requests>=2.18.1',
'PyYAML>=3.12'
]
if PY2:
install_requires.append('funcsigs>=1.0.2')
__version__ = get_version()
setup(
name='firefly-python',
version=__version__,
author='rorodata',
author_email='[email protected]',
description='deploying functions made easy',
long_description=__doc__,
packages=find_packages(),
include_package_data=True,
install_requires=install_requires,
entry_points='''
[console_scripts]
firefly=firefly.main:main
''',
)