1{
2 lib,
3 buildPythonPackage,
4 colorthief,
5 fetchFromGitHub,
6 nix-update-script,
7 pillow,
8 pytestCheckHook,
9 rustPlatform,
10}:
11
12buildPythonPackage rec {
13 pname = "modern-colorthief";
14 version = "0.1.7";
15 pyproject = true;
16
17 src = fetchFromGitHub {
18 owner = "baseplate-admin";
19 repo = "modern_colorthief";
20 tag = version;
21 hash = "sha256-tALF9EIBTyVi3Ca4kQl9x+V12gjr0xH9OOmuoToxuJA=";
22 };
23
24 cargoDeps = rustPlatform.fetchCargoVendor {
25 inherit pname version src;
26 hash = "sha256-DldfoDpE7epb99Huq0RXkS3cAw0RtIzdWvr9OuZRZTI=";
27 };
28
29 nativeBuildInputs = [
30 rustPlatform.cargoSetupHook
31 rustPlatform.maturinBuildHook
32 ];
33
34 optional-dependencies = {
35 test = [
36 colorthief
37 pillow
38 ];
39 };
40
41 nativeCheckInputs = [ pytestCheckHook ] ++ lib.attrValues optional-dependencies;
42
43 disabledTestPaths = [
44 # Requires `fast_colorthief`, which isn't packaged
45 "examples/test_time.py"
46 ];
47
48 pythonImportsCheck = [ "modern_colorthief" ];
49
50 passthru = {
51 updateScript = nix-update-script { };
52 };
53
54 meta = {
55 homepage = "https://modern-colorthief.readthedocs.io/";
56 changelog = "https://github.com/baseplate-admin/modern_colorthief/releases/tag/${src.tag}";
57 license = lib.licenses.mit;
58 maintainers = with lib.maintainers; [ getchoo ];
59 };
60}