{% set name = "snowflake-ml-python" %}
{% set version = "1.5.3" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/snowflakedb/{{ name }}/archive/refs/tags/{{ version }}.tar.gz
  sha256: 65e70b14589f7bb720b1522b628bd129140ef592c460be3c64d9898b210eae05

build:
  number: 0
  skip: True # [py<38 or py>311]
  # bazel not available on s390x
  skip: True # [s390x]

# It is sufficient to look at [requirements.yml](https://github.com/snowflakedb/snowflake-ml-python/blob/main/requirements.yml) and update
# the `run` and `run_constrained` section accordingly.
#
# `version_requirements` or `version_requirements_conda` -> `run`
# (`version_requirements` or `version_requirements_conda`) and `requirements_extra_tags` -> `run_constrained`
#
# This meta.yaml is up-to-date for defining `run` and `run_constrained` dependencies,
# therefore it can be used to double check the runtime dependencies or as a starting point:
# https://github.com/snowflakedb/snowflake-ml-python/blob/main/ci/conda_recipe/meta.yaml
#
# Snowflake marks the optional dependency with the use of the `requirements_extra_tags` tag. The tags refer to models used within *snowflake-ml*
# which the user may or may not want to use together with the *snowflake* platform. They explained that because they control the environment and
# features of the platform, it is not necessary to pull those extra requirements in the `run` section. It is ok to leave them in the
# `run_constrained` section.
requirements:
  build:
    # For win, git is installed on our runners.
    # To run a local build, use m2-git or have git installed.
    - git         # [not win]
    # Bazel has rules to run Miniconda to build the package so make sure that the Miniconda and conda-libmamba-solver versions are correct, 
    # because it can affect the build process, see https://github.com/snowflakedb/snowflake-ml-python/blob/main/third_party/rules_conda/conda.bzl
    - bazel 6.2.0
    - {{ compiler('c') }}
  host:
    - python
    - pip
    - setuptools
    - wheel
  run:
    - python
    - absl-py >=0.15,<2
    - aiohttp !=4.0.0a0,!=4.0.0a1
    - anyio >=3.5.0,<4
    - cachetools >=3.1.1,<6
    - cloudpickle >=2.0.0
    - fsspec >=2022.11,<2024
    - importlib_resources >=6.1.1,<7
    - numpy >=1.23,<2
    - packaging >=20.9,<24
    - pandas >=1.0.0,<3
    - pyarrow
    - pytimeparse >=1.1.8,<2
    - pyyaml >=6.0,<7
    # requests is an extra dependency for fsspec[http]
    - requests
    - retrying >=1.3.3,<2
    - s3fs >=2022.11,<2024
    - scikit-learn >=1.2.1,<1.4
    - scipy >=1.9,<2
    - snowflake-connector-python >=3.5.0,<4
    - snowflake-snowpark-python >=1.15.0,<2
    - sqlparse >=0.4,<1
    - typing-extensions >=4.1.0,<5
    - xgboost >=1.7.3,<2
  run_constrained:
    - catboost >=1.2.0,<2
    # Seems to be optional
    - shap ==0.42.1
    # Seems to be optional to LLM although not explicitly used. Also, not sure if pip will install it.
    - sentencepiece >=0.1.95,<1
    # Seems to be optional depending on task executed within huggingface pipeline, but it's listed as part of transformers.
    # Also, not sure if pip will install it, also there is inconsistency as far as range requirement. (less restrictive one seems to be >=0.10,<1)
    - tokenizers >=0.10,<1
    # these dependencies are specified as optional and also in a run_contrained section of their recipe
    # but in reality they may always be imported, hence they should be specified in the run section
    # ...
    # seems to be imported when LLM is used
    # we don't have this on defaults or other channels
    - peft >=0.5.0,<1
    # seems to be required by one specific model specification builder
    - lightgbm >=3.3.5,<5
    # seems to be required by one specific model handler
    - mlflow >=2.1.0,<2.4
    # seems to be required in multiple places, especially LLM which seems to be included, also on all platforms, not just win
    - pytorch >=2.0.1,<3
    # seems to be required in multiple places
    # requiring this as a run dependency seems to cause a lot of dependency problems.
    - tensorflow >=2.10,<3
    # Seems to be depepndent on pytorch, so not optional
    - torchdata >=0.4,<1
    # seems to be in multiple places, especially LLM which seems to be included
    - transformers >=4.32.1,<5
    # seems to be required by one specific model handler
    - sentence-transformers >=2.2.2,<3

test:
  imports:
    - snowflake.ml
    - snowflake.ml.fileset
    - snowflake.ml.model
    - snowflake.ml.modeling
    - snowflake.ml.registry
    - snowflake.ml.utils
  requires:
    - pip
  commands:
    # On win-64 this does not pick up xgboost for some reason, so skip it.
    - pip check   # [not win]

about:
  home: https://github.com/snowflakedb/snowflake-ml-python
  summary: Snowflake machine learning library.
  license: Apache-2.0
  license_family: Apache
  license_file: LICENSE.txt
  description: |
    The machine learning client library that is used for interacting with Snowflake
    to build machine learning solutions. Functionalities include model uploading,
    training, feature engineering, etc.
  dev_url: https://github.com/snowflakedb/snowflake-ml-python
  doc_url: https://docs.snowflake.com/developer-guide/snowpark-ml/index

extra:
  recipe-maintainers:
    - sumit0190
