{% set name = "mlflow" %}
{% set version = "2.12.2" %}

# MLFlow offers two variants, a "normal" install and a "skinny" install with
# a reduced installation and fewer dependencies. The skinny installation is obtained
# by setting the environment variable MLFLOW_SKINNY at pip install time. For conda
# we accomplish this with two conda packages, mflow and mlflow-skinny. Note that this
# is not the same as matplotlib-base/matplotlib, where the only differences is the
# dependency set; the installed code is different as well.

{% if mlflow_variant == "skinny" %}
{% set mlflow_suffix = "-skinny" %}
{% set mlflow_other = "" %}
{% else %}
{% set mlflow_suffix = "" %}
{% set mlflow_other = "-skinny" %}
{% endif %}

package:
  name: mlflow{{ mlflow_suffix }}
  version: {{ version }}

source:
  # Using github as source for mlflow-skinny which does not exist on PyPI
  url: https://github.com/mlflow/mlflow/archive/refs/tags/v{{ version }}.zip
  sha256: bdec209c55cd33fbe79deb32d6cb9966d50a4674aac00b706e2658ac81ee58bc

build:
  number: 0
  entry_points:
    - mlflow=mlflow.cli:cli
  skip: true  # [py<38 or s390x]
  script: |
{% if mlflow_variant == "skinny" %}
    export MLFLOW_SKINNY=1  # [not win]
    set MLFLOW_SKINNY=1  # [win]
    cp {{ SRC_DIR }}/pyproject.toml orig_pyproject.toml  # [not win]
    copy {{ SRC_DIR }}\pyproject.toml orig_pyproject.toml  # [win]
    cp {{ SRC_DIR }}/pyproject.skinny.toml pyproject.toml  # [not win]
    copy {{ SRC_DIR }}\pyproject.skinny.toml pyproject.toml  # [win]
{% endif %}
    {{ PYTHON }} -m pip install . --no-deps --no-build-isolation --ignore-installed --no-cache-dir -vvv
{% if mlflow_variant == "skinny" %}
    cp orig_pyproject.toml pyproject.toml  # [not win]
    copy orig_pyproject.toml pyproject.toml  # [win]
{% endif %}

requirements:
  host:
    - pip
    - python
    - setuptools
    - wheel
  run:
    - python
    - click >=7.0,<9
    - cloudpickle <4
    - entrypoints <1
    - gitpython >=3.1.9,<4
    - importlib-metadata <8,>=3.7.0,!=4.7.0
    - packaging <25
    - protobuf >=3.12.0,<5
    - pytz <2025
    - pyyaml >=5.1,<7
    - requests >=2.17.3,<3
    - sqlparse >=0.4.0,<1
{% if mlflow_variant != "skinny" %}
    - flask <4
    - jinja2 <4,>=2.11  # [not win]
    - jinja2 <4,>=3.0  # [win]
    - alembic <2,!=1.10.0
    - docker-py >=4.0.0,<8
    - graphene <4
    - gunicorn <23  # [not win]
    - markdown >=3.3,<4
    - matplotlib-base <4
    - numpy <2
    - pandas <3
    - pyarrow <16,>=4.0.0
    - querystring_parser <2
    - scikit-learn <2
    - scipy <2
    - sqlalchemy >=1.4.0,<3
    - waitress <4  # [win]
{% endif %}
  run_constrained:
    - mlflow{{ mlflow_other }} <0a0
    - mxnet !=1.8.0
    - fastai >=2.4.1
    - spacy >=3.3.0
    - tensorflow >=2.10.0
    - pytorch >=1.11.0
    - torchvision >=0.12.0
    - lightning>=1.8.1
    - xgboost >=0.82
    - onnx >=1.11.0
    - holidays !=0.25
    - shap >=0.42.1
    - openai <1.0
    - azureml-core >=1.2.0
    - mlserver >=1.2.0, !=1.3.1, <1.4.0
    - mlserver-mlflow >=1.2.0,!=1.3.1,<1.4.0
    # mlflow-gateway, mlflow-skinny-gateway, genai
    - pydantic >=1.0,<3
    - fastapi <1
    - uvicorn-standard <1
    - watchfiles <1
    - aiohttp <4
    - boto3 >=1.28.56,<2
    - tiktoken <1
    - slowapi >=0.1.9,<1
    # databricks
    - azure-storage-file-datalake >12
    - google-cloud-storage >=1.30.0
    - boto3 >1

test:
  imports:
    - mlflow
    - mlflow.projects
    - mlflow.protos
    - mlflow.rfunc
    - mlflow.store
    - mlflow.tracking
    - mlflow.utils
{% if mlflow_variant != "skinny" %}
    - mlflow.models
    - mlflow.pyfunc
    - mlflow.pytorch
    - mlflow.sagemaker
    - mlflow.server
{% endif %}
  commands:
    - mlflow --help
    - pip check
  requires:
    - pip

about:
  home: https://mlflow.org/
{% if mlflow_variant == "skinny" %}
  summary: "MLflow Skinny: A Lightweight Machine Learning Lifecycle Platform Client"
  description: |
    MLflow Skinny is a lightweight MLflow package without SQL storage, server,
    UI, or data science dependencies.
{% else %}
  summary: "MLflow: A Machine Learning Lifecycle Platform"
  description: |
    MLflow is a platform to streamline machine learning development, including tracking
    experiments, packaging code into reproducible runs, and sharing and deploying models.
    MLflow offers a set of lightweight APIs that can be used with any existing machine
    learning application or library (TensorFlow, PyTorch, XGBoost, etc), wherever you
    currently run ML code (e.g. in notebooks, standalone applications or the cloud).
{% endif %}
  license: Apache-2.0
  license_family: APACHE
  license_file: LICENSE.txt
  doc_url: https://mlflow.org
  dev_url: https://github.com/mlflow/mlflow

extra:
  feedstock-name: mlflow
  recipe-maintainers:
    - harupy
    - aarondav
    - ahirreddy
    - andrewmchen
    - aveshcsingh
    - dbczumar
    - jaroslawk
    - mateiz
    - mparkhe
    - pogil
    - smurching
    - sueann
    - tomasatdatabricks
    - xhochy
    - zangr
    - janjagusch
