about summary refs log tree commit diff
path: root/pkgs/development/python-modules/materialyoucolor/default.nix
blob: 3cb67e4aefd96c2ed9bfc24ddbf3cdaaa844e8c0 (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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
{
  lib,
  buildPythonPackage,
  fetchurl,
  fetchPypi,
  setuptools,
  pybind11,
  requests,
  rich,
  pillow,
}:

let
  test-image = fetchurl {
    name = "test-image.jpg";
    url = "https://unsplash.com/photos/u9tAl8WR3DI/download";
    hash = "sha256-shGNdgOOydgGBtl/JCbTJ0AYgl+2xWvCgHBL+bEoTaE=";
  };
in
buildPythonPackage rec {
  pname = "materialyoucolor";
  version = "2.0.9";
  pyproject = true;

  # PyPI sources contain additional vendored sources
  src = fetchPypi {
    inherit pname version;
    hash = "sha256-J35//h3tWn20f5ej6OXaw4NKnxung9q7m0E4Zf9PUw4=";
  };

  build-system = [
    setuptools
    pybind11
  ];

  nativeCheckInputs = [
    requests
    rich
    pillow
  ];

  checkPhase = ''
    runHook preCheck
    python tests/test_all.py ${test-image} 1
    runHook postCheck
  '';

  pythonImportsCheck = [
    "materialyoucolor"
    "materialyoucolor.quantize" # ext
  ];

  meta = {
    description = "Material You color generation algorithms in python";
    homepage = "https://github.com/T-Dynamos/materialyoucolor-python";
    license = lib.licenses.mit;
    maintainers = with lib.maintainers; [ tomasajt ];
  };
}