From 7ae1b5b010c7dcd746766246fd26f3f03ab07902 Mon Sep 17 00:00:00 2001 From: Philipp Klaus Date: Mon, 14 Aug 2017 16:35:52 +0200 Subject: [PATCH] opus20: requirements in setup.py, optional ones: [webserver] --- opus20/README.md | 4 ++++ opus20/opus20/opus20_web.py | 2 +- opus20/opus20/webapp/__init__.py | 2 ++ opus20/setup.py | 4 ++++ 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/opus20/README.md b/opus20/README.md index cac5711..fbe1dc9 100644 --- a/opus20/README.md +++ b/opus20/README.md @@ -22,6 +22,10 @@ This package can be installed via pip: pip install --upgrade https://github.com/pklaus/opus20/archive/master.zip +To install all requirements for the included plot web server, too, run this command instead: + + pip install --upgrade https://github.com/pklaus/opus20/archive/master.zip#egg=opus20[webserver] + #### Usage The Python package installs a command line tool to query the device diff --git a/opus20/opus20/opus20_web.py b/opus20/opus20/opus20_web.py index cd0bc77..5984e85 100755 --- a/opus20/opus20/opus20_web.py +++ b/opus20/opus20/opus20_web.py @@ -1,7 +1,7 @@ #!/usr/bin/env python # local deps -from opus20 import PlotWebServer +from opus20.webapp import PlotWebServer # std lib import argparse diff --git a/opus20/opus20/webapp/__init__.py b/opus20/opus20/webapp/__init__.py index 3d525b2..77aa216 100755 --- a/opus20/opus20/webapp/__init__.py +++ b/opus20/opus20/webapp/__init__.py @@ -37,6 +37,8 @@ class PlotWebServer(Bottle): } def __init__(self, host, log_file, **kwargs): + # check for different requirements at object instatiation + import matplotlib, jinja2, pandas, numpy, pillow if 'debug' in kwargs: self.debug = kwargs['debug'] del kwargs['debug'] diff --git a/opus20/setup.py b/opus20/setup.py index e63d2c2..5c6db36 100644 --- a/opus20/setup.py +++ b/opus20/setup.py @@ -25,6 +25,10 @@ setup(name='opus20', 'opus20_fakeserver = opus20.opus20_fakeserver:main', ], }, + install_requires = [], + extras_require = { + 'webserver': ["bottle", "matplotlib", "jinja2", "pandas", "numpy", "pillow"], + }, include_package_data = True, zip_safe = True, platforms = 'any', -- 2.43.0