summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/py-lightgbm/package.py
blob: 5d08bb624116b79a928a6f7fee4e21a69b14f3fb (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# Copyright 2013-2023 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)

from spack.package import *


class PyLightgbm(PythonPackage):
    """LightGBM is a gradient boosting framework that uses tree
    based learning algorithms."""

    homepage = "https://github.com/microsoft/LightGBM"
    pypi = "lightgbm/lightgbm-3.1.1.tar.gz"

    license("MIT")

    version("3.1.1", sha256="babece2e3613e97748a67ed45387bb0e984bdb1f4126e39f010fbfe7503c7b20")

    variant("mpi", default=False, description="Build with mpi support")

    depends_on("py-setuptools", type="build")
    # in newer pip versions --install-option does not exist
    depends_on("py-pip@:23.0", when="+mpi", type="build")
    depends_on("py-wheel", type=("build", "run"))
    depends_on("py-numpy", type=("build", "run"))
    depends_on("py-scipy", type=("build", "run"))
    depends_on("py-scikit-learn@:0.21,0.22.1:", type=("build", "run"))

    depends_on("cmake@3.8:", type="build")

    depends_on("mpi", when="+mpi")

    def install_options(self, spec, prefix):
        args = []

        if spec.satisfies("+mpi"):
            args.append("--mpi")

        return args