Skip to content

Commit

Permalink
Merge pull request pyFFTW#218 from jakirkham/opt_dask_req
Browse files Browse the repository at this point in the history
Explicitly add Dask Array as an extra requirement
  • Loading branch information
jakirkham authored Mar 14, 2018
2 parents 406be4a + 507248a commit 39a5730
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 9 deletions.
20 changes: 14 additions & 6 deletions pyfftw/interfaces/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,10 +236,18 @@
del scipy
from . import scipy_fftpack

try:
from dask.array.fft import fft_wrap
except ImportError:
pass
else:
del fft_wrap
from distutils.version import LooseVersion
import numpy

fft_wrap = None
if LooseVersion(numpy.__version__) > LooseVersion("1.10"):
try:
from dask.array.fft import fft_wrap
except ImportError:
pass
del LooseVersion
del numpy

if fft_wrap:
from . import dask_fft
del fft_wrap
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cython
numpy>=1.6
scipy>=0.12.0
dask>=0.15.0
dask[array]>=0.15.0
5 changes: 5 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -759,6 +759,10 @@ def setup_package():

install_requires = [numpy_requirement]

opt_requires = {
'dask': ['numpy>=1.10, <2.0', 'dask[array]>=0.15.0']
}

setup_args = {
'name': 'pyFFTW',
'version': versioneer.get_version(),
Expand Down Expand Up @@ -786,6 +790,7 @@ def setup_package():
if using_setuptools:
setup_args['setup_requires'] = build_requires
setup_args['install_requires'] = install_requires
setup_args['extras_require'] = opt_requires

if len(sys.argv) >= 2 and (
'--help' in sys.argv[1:] or
Expand Down
5 changes: 3 additions & 2 deletions test/test_pyfftw_dask_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,14 @@
import unittest
import numpy

try:
if interfaces.dask_fft:
import dask.array as da
from dask.array import fft as da_fft
from dask.array.fft import fft_wrap
except ImportError:
else:
da = None
da_fft = None
fft_wrap = None

import warnings
import copy
Expand Down

0 comments on commit 39a5730

Please sign in to comment.