{% set version = "0.20.0" %}
{% set name = "scikit-learn" %}

package:
  name: {{ name }}
  version: {{ version }}

source:
  fn: {{ name }}-{{ version }}.tar.gz
  # url: https://pypi.io/packages/source/{{ name[0] }}/{{ name }}/{{ name }}-{{ version }}.tar.gz
  url: https://github.com/scikit-learn/scikit-learn/archive/{{ version }}.tar.gz
  sha256: 6f0e84931af697d7c2841ccdf50110f69cc964788f503e2f43eeaf0240482dc0
  patches:
    - atol_in_gaussian_tests.patch  # [win]
    - 0001-disable-test_predict_proba_binary.patch  # [win and vc==9]
    # fails for mkl/py37/win32 - can apply selector if you want, but this should not be harmful.
    - 0001-reduce-precision-of-almost_equal-in-test_graph_lasso.patch
    # https://github.com/scikit-learn/scikit-learn/pull/12159
    - remove_nested_parallelism_in_mean_shift.patch

build:
  number: 1
  # pip wants to use wheels for numpy and scipy.  Why?  Ours not good enough for it?
  # script: pip install --no-index -vvv .
  script: python setup.py install --single-version-externally-managed --record=record.txt
  skip: True  # [blas_impl == 'openblas' and win]

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
  host:
    - python
    - cython
    - setuptools
    - numpy-devel  {{ numpy }}
    - mkl-devel  {{ mkl }}  # [blas_impl == 'mkl']
    - openblas-devel {{ openblas }}  # [blas_impl == 'openblas']
  run:
    - python
    - scipy

# TODO :: Fix this properly.
# Running into the same suspected i686 MKL bug that afflicts numpy and scipy
# (it is a shame to disable all tests for a few bad eggs, and, atol=0, really?):
# test_common.py.test_non_meta_estimators:check_supervised_y_2d(GaussianProcessRegressor)
# site-packages/numpy/testing/utils.py", line 778, in assert_array_compare
#     raise AssertionError(msg)
# AssertionError:
# Not equal to tolerance rtol=1e-07, atol=0
#
# (mismatch 30.0%)
#  x: array([ -4.066801e-08,   1.000000e+00,   2.000000e+00,   4.349049e-08,
#          1.000000e+00,   2.000000e+00,   1.880388e-08,   1.000000e+00,
#          2.000000e+00,   3.421711e-09])
#  y: array([ -4.066806e-08,   1.000000e+00,   2.000000e+00,   4.349050e-08,
#          1.000000e+00,   2.000000e+00,   1.880386e-08,   1.000000e+00,
#          2.000000e+00,   3.421711e-09])
#
# ----------------------------------------------------------------------
# Ran 7994 tests in 367.589s
#
# FAILED (SKIP=77, failures=2)

test:
  requires:
    - pytest
  imports:
    - sklearn
  commands:
    - pytest --showlocals --durations=20 --pyargs sklearn    # [not linux32 and not ppc64le]
    - OMP_NUM_THREADS=1 pytest --showlocals --durations=20 --pyargs sklearn   # [ppc64le]

about:
  home: http://scikit-learn.org/
  license: BSD 3-Clause
  license_file: COPYING
  summary: A set of python modules for machine learning and data mining

extra:
  recipe-maintainers:
    - amueller
    - astaric
    - jakirkham
    - ogrisel
    - ocefpaf
    - lesteve
    - msarahan
