From 47e19f6fe72ce5f50a8c22a530a12894d1c0c6ec Mon Sep 17 00:00:00 2001
From: Paul McCarthy <pauldmccarthy@gmail.com>
Date: Fri, 12 Jan 2018 11:45:49 +0000
Subject: [PATCH] Optional dependencies are now optional

---
 requirements-extra.txt |  4 ++++
 requirements.txt       |  4 ----
 setup.py               | 11 +++++++++--
 3 files changed, 13 insertions(+), 6 deletions(-)
 create mode 100644 requirements-extra.txt

diff --git a/requirements-extra.txt b/requirements-extra.txt
new file mode 100644
index 000000000..a888efb2f
--- /dev/null
+++ b/requirements-extra.txt
@@ -0,0 +1,4 @@
+indexed_gzip>=0.6.1,<1
+wxpython>=3.0.2.0,<4.1
+trimesh==2.*
+rtree==0.8
diff --git a/requirements.txt b/requirements.txt
index c902fc6b1..5044c24cd 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -3,7 +3,3 @@ deprecation==1.*
 numpy==1.*
 scipy>=0.18,<1
 nibabel==2.*
-indexed_gzip>=0.6.1,<1
-wxpython>=3.0.2.0,<4.1
-trimesh==2
-rtree==0.8
diff --git a/setup.py b/setup.py
index 05951435b..c1fe26d73 100644
--- a/setup.py
+++ b/setup.py
@@ -20,10 +20,16 @@ from setuptools import Command
 basedir = op.dirname(__file__)
 
 # Dependencies are listed in requirements.txt
-install_requires = open(op.join(basedir, 'requirements.txt'), 'rt').readlines()
+with open(op.join(basedir, 'requirements.txt'), 'rt') as f:
+    install_requires = f.readlines()
 
 # Development/test dependencies are listed in requirements-dev.txt
-dev_requires = open(op.join(basedir, 'requirements-dev.txt'), 'rt').readlines()
+with open(op.join(basedir, 'requirements-dev.txt'), 'rt') as f:
+    dev_requires = f.readlines()
+
+# Optional dependencies are listed in requirements-extra.txt
+with open(op.join(basedir, 'requirements-extra.txt'), 'rt') as f:
+    extra_requires = {'extras' : f.readlines()}
 
 packages = find_packages(
     exclude=('doc', 'tests', 'dist', 'build', 'fslpy.egg-info'))
@@ -109,6 +115,7 @@ setup(
     packages=packages,
 
     install_requires=install_requires,
+    extras_require=extra_requires,
     setup_requires=dev_requires,
 
     test_suite='tests',
-- 
GitLab