From f3061dd6de119c4095b0a42850c9464a97f94a34 Mon Sep 17 00:00:00 2001 From: Marion Le Borgne Date: Thu, 7 Sep 2017 22:54:54 +0200 Subject: [PATCH] make analytics install optional --- README.rst | 14 +++++++------- requirements/analytics.txt | 3 +++ requirements.txt => requirements/core.txt | 5 +---- requirements/muse.txt | 1 + setup.py | 23 ++++++++++++++++------- 5 files changed, 28 insertions(+), 18 deletions(-) create mode 100644 requirements/analytics.txt rename requirements.txt => requirements/core.txt (63%) create mode 100644 requirements/muse.txt diff --git a/README.rst b/README.rst index b7ce9c1..d352c67 100644 --- a/README.rst +++ b/README.rst @@ -7,11 +7,11 @@ Features ======== CloudBrain is a platform for real-time sensor data analysis and -visualization. +visualization. -- **Stream sensor data** in a unified format. -- **Store sensor data** in a central database. -- **Analyze sensor data** to find patterns. +- **Stream sensor data** in a unified format. +- **Store sensor data** in a central database. +- **Analyze sensor data** to find patterns. - **Visualize sensor data** and patterns in real-time. .. figure:: https://raw.githubusercontent.com/cloudbrain/cloudbrain/master/docs/images/features.png @@ -30,9 +30,9 @@ Setup Optional -------- -Optional CloudBrain modules can be installed: - -- Muse source module: ``pip install .[muse] --user`` *(Python ``3.*`` only)* +Optional CloudBrain modules can be installed: +- Analytics modules: ``pip install .[analytics] --user`` +- Muse source module: ``pip install .[muse] --user`` *(Python ``3.*`` only)* Run the tests ------------- diff --git a/requirements/analytics.txt b/requirements/analytics.txt new file mode 100644 index 0000000..9f36827 --- /dev/null +++ b/requirements/analytics.txt @@ -0,0 +1,3 @@ +scipy==0.18.1 +numpy==1.11.2 +mne==0.10.0 diff --git a/requirements.txt b/requirements/core.txt similarity index 63% rename from requirements.txt rename to requirements/core.txt index ea89f04..c713a44 100644 --- a/requirements.txt +++ b/requirements/core.txt @@ -1,7 +1,4 @@ simplejson==3.8.2 pika==0.10 -numpy==1.11.2 -scipy==0.18.1 -pyserial==2.7 -mne==0.10.0 requests[security]==2.18.1 +pyserial==2.7 diff --git a/requirements/muse.txt b/requirements/muse.txt new file mode 100644 index 0000000..3112e5d --- /dev/null +++ b/requirements/muse.txt @@ -0,0 +1 @@ +python-osc==1.6 \ No newline at end of file diff --git a/setup.py b/setup.py index 9dc6c4f..db1fffb 100644 --- a/setup.py +++ b/setup.py @@ -4,15 +4,23 @@ import os # Get __version__ and set other constants. -exec(open(os.path.join('src', 'cloudbrain', - 'version.py')).read()) +# Source: https://stackoverflow.com/a/16084844 +with open(os.path.join('src', 'cloudbrain', 'version.py'), 'r') as f: + exec(f.read()) URL = 'https://github.com/cloudbrain/cloudbrain' DOWNLOAD_URL='%s/archive/%s.tar.gz' % (URL, __version__) DESCRIPTION = open('README.rst').read() -# Requirements -install_reqs = parse_requirements('requirements.txt', session=PipSession()) -reqs = [str(ir.req) for ir in install_reqs] +# Helper function for requirements parsing by requirement type +def parse_reqs(req_type): + reqs_file = os.path.join('requirements', '%s.txt' % req_type) + install_reqs = parse_requirements(reqs_file, session=PipSession()) + reqs = [str(ir.req) for ir in install_reqs] + return reqs + +# Get requirements for all types +REQUIREMENT_TYPES = ['core', 'analytics', 'muse'] +reqs = {req_type: parse_reqs(req_type) for req_type in REQUIREMENT_TYPES} setup(name='cloudbrain', version=__version__, @@ -23,7 +31,7 @@ download_url=DOWNLOAD_URL, package_dir={'': 'src'}, packages=find_packages('src'), - install_requires=reqs, + install_requires=reqs['core'], long_description=DESCRIPTION, test_suite='nose.collector', tests_require=['mock==1.0.1', 'nose'], @@ -33,7 +41,8 @@ "cloudbrain.schema": ["*.json"] }, extras_require={ - 'muse:python_version>="3"': ['python-osc==1.6'], + 'muse:python_version>="3"': reqs['muse'], + 'analytics': reqs['analytics'] }, entry_points = { 'console_scripts':