{% set name = "scikit-image" %}
{% set version = "0.22.0" %}
{% set sha256 = "2875c81ffb224f9f25a1274734b502fb993cc729a2c790009d38035e52e6a123" %}

{% set build_number = "0" %}


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

source:
  url: https://github.com/scikit-image/scikit-image/archive/refs/tags/v{{ version }}.tar.gz
  sha256: {{ sha256 }}
  patches:
    - skip-broken-tests.patch

build:
  number: {{ build_number }}
  skip: true  # [py<39]
  entry_points:
    - skivi = skimage.scripts.skivi:main


requirements:
  build:
    # pythran code needs clang-cl on windows
    - clang                 # [win]
    - lld     # [win]
    - {{ compiler("c") }}
    - {{ compiler("cxx") }}
    - m2-patch              # [win]
    - patch                 # [not win]
  host:
    - python
    - cython >=0.29.32,<3
    - numpy {{ numpy }}
    - packaging
    - pip
    - pythran
    - meson-python
    - lazy_loader >=0.3
  run:
    - python
    - {{ pin_compatible('numpy', lower_bound='1.22') }}
    - scipy >=1.8
    - networkx >=2.8
    - pillow >=9.0.1
    - imageio >=2.27
    - tifffile >=2022.8.12
    - packaging >=21
    - lazy_loader >=0.3
    - _openmp_mutex  # [linux]
  run_constrained:
    - matplotlib-base >=3.5
    - pooch >=1.6.0
    - astropy >=5.0
    - scikit-learn >=1.1
    - pywavelets >=1.1.1
    - cloudpickle >=0.2.1
    - dask-core >=2021.1.0

{% set tests_to_skip = "_not_a_real_test" %}

# TODO: Report this upstream
# It seems that the apply_parallel tests can have relatively small errors,
# depending on underlying system; conda-forge has observed it on Windows, and
# Anaconda has observed it on Windows, macOS, and Linux.
{% set tests_to_skip = tests_to_skip + " or test_apply_parallel_rgb" %} # [osx and x86_64]

# https://github.com/scikit-image/scikit-image/issues/6865
{% set tests_to_skip = tests_to_skip + " or test_analytical_moments_calculation" %}

# https://github.com/scikit-image/scikit-image/issues/7061
{% set tests_to_skip = tests_to_skip + " or test_ellipse_parameter_stability" %}

# https://github.com/scikit-image/scikit-image/issues/6994
{% set tests_to_skip = tests_to_skip + " or test_imsave_roundtrip[shape1-uint16]" %}          # [s390x]

test:
  source_files:
    - pyproject.toml
  requires:
    - pip
    - pooch >=1.6.0
    - asv
    - matplotlib-base
    - pywavelets
    - scikit-learn
    - numpydoc >=1.5
    - pooch
    - pytest >=7.0
    - pytest-cov >=2.11.0
    - pytest-localserver
    #- pytest-faulthandler
  imports:
    - skimage
  commands:
    - pip check
    - set OPENBLAS_NUM_THREADS=1          # [win]
    - set OMP_NUM_THREADS=1               # [win]
    - export OPENBLAS_NUM_THREADS=1       # [not win]
    - export OMP_NUM_THREADS=1            # [not win]
    - setx MPLBACKEND "Agg"  # [win]
    - export MPLBACKEND=Agg  # [unix]
    - SKIMAGE_TEST_STRICT_WARNINGS=0 pytest --verbose --pyargs skimage -k "not ({{ tests_to_skip }})"  # [unix]
    - set "SKIMAGE_TEST_STRICT_WARNINGS=0" & pytest --verbose --pyargs skimage -k "not ({{ tests_to_skip }})"  # [win]

about:
  home: https://scikit-image.org/
  license: BSD-3-Clause AND MIT and BSD-2-Clause
  license_family: Other
  license_file: LICENSE.txt
  summary: Image processing in Python.
  description: |
    scikit-image is a collection of algorithms for image processing.
    It is available free of charge and free of restriction.
    We pride ourselves on high-quality, peer-reviewed code,
    written by an active community of volunteers.
  dev_url: https://github.com/scikit-image/scikit-image
  doc_url: https://scikit-image.org/docs/stable/

extra:
  recipe-maintainers:
    - jakirkham
    - jni
    - msarahan
    - ocefpaf
    - soupault
    - hmaarrfk
    - emmanuelle
