Commit 9312bd1e authored by Michael Droettboom's avatar Michael Droettboom Committed by GitHub

Merge pull request #212 from rth/package-joblib

Package joblib
parents db4e1d02 bad48f6b
......@@ -18,7 +18,7 @@ jobs:
- restore_cache:
keys:
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v8-
- v1-emsdk-{{ checksum "emsdk/Makefile" }}-v11-
- run:
name: build
......@@ -36,7 +36,7 @@ jobs:
paths:
- ./emsdk/emsdk
- ~/.ccache
key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v8-{{ .BuildNum }}
key: v1-emsdk-{{ checksum "emsdk/Makefile" }}-v11-{{ .BuildNum }}
- persist_to_workspace:
root: .
......
package:
name: joblib
version: "0.11"
source:
url: https://pypi.io/packages/source/j/joblib/joblib-0.11.tar.gz
sha256: 7b8fd56df36d9731a83729395ccb85a3b401f62a96255deb1a77220c00ed4085
patches:
- patches/use-setuptools.patch
- patches/ctypes-import.patch
test:
imports:
- joblib
diff --git a/joblib/backports.py b/joblib/backports.py
index 7dd3df1..a49ef78 100644
--- a/joblib/backports.py
+++ b/joblib/backports.py
@@ -3,7 +3,6 @@ Backports of fixes for joblib dependencies
"""
import os
import time
-import ctypes
import sys
from distutils.version import LooseVersion
@@ -34,6 +33,8 @@ except ImportError:
if os.name == 'nt':
error_access_denied = 5
+ import ctypes
+
try:
from os import replace
except ImportError:
diff --git a/setup.py b/setup.py
index 134db18..f705b28 100755
--- a/setup.py
+++ b/setup.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
-from distutils.core import setup
+from setuptools import setup
import sys
import joblib
import pytest
def test_joblib_numpy_pickle(selenium, request):
if selenium.browser == 'chrome':
request.applymarker(pytest.mark.xfail(
run=False, reason='chrome not supported'))
selenium.load_package(['numpy', 'joblib'])
selenium.run("""
import joblib
import numpy as np
from numpy.testing import assert_array_equal
X = np.ones(10)
file_path = "./X.pkl"
joblib.dump(X, file_path)
X2 = joblib.load(file_path)
assert_array_equal(X, X2)""")
def test_joblib_parallel(selenium):
selenium.load_package(['numpy', 'joblib'])
selenium.clean_logs()
selenium.run("""
from math import sqrt
from joblib import Parallel, delayed
# check that the default multiprocessing backend
# gracefully reduces to n_jobs=1
res = Parallel(n_jobs=2)(delayed(sqrt)(i ** 2)
for i in range(10))
assert res == [sqrt(i ** 2) for i in range(10)]
# check threading backend
Parallel(n_jobs=2, backend='threading')(
delayed(sqrt)(i ** 2) for i in range(10))
""")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment