opus20: requirements in setup.py, optional ones: [webserver]
authorPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Mon, 14 Aug 2017 14:35:52 +0000 (16:35 +0200)
committerPhilipp Klaus <klaus@physik.uni-frankfurt.de>
Mon, 14 Aug 2017 14:35:57 +0000 (16:35 +0200)
opus20/README.md
opus20/opus20/opus20_web.py
opus20/opus20/webapp/__init__.py
opus20/setup.py

index cac571188e170b6b8d9837dc55db8b73adc68810..fbe1dc963cbf1a2e9db68c434c82142e76f8239d 100644 (file)
@@ -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
index cd0bc773b2702090977fcec8e47d960235d9b76f..5984e85a322fd7dc10a9427f7bb3637f6f546d0a 100755 (executable)
@@ -1,7 +1,7 @@
 #!/usr/bin/env python
 
 # local deps
-from opus20 import PlotWebServer
+from opus20.webapp import PlotWebServer
 
 # std lib
 import argparse
index 3d525b20026a8b91dc92308b9a918ff81f07f8b8..77aa216b48be0ebfdc4a928f92737cbfed020d9c 100755 (executable)
@@ -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']
index e63d2c2d1c6e18b39e51bb2e95c653cc2bf932fe..5c6db365219df3ee745aeb2e270bcabf850a8de0 100644 (file)
@@ -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',