1{
2 lib,
3 python3,
4 fetchFromGitHub,
5}:
6
7python3.pkgs.buildPythonApplication rec {
8 pname = "modelscan";
9 version = "0.8.5";
10 pyproject = true;
11
12 src = fetchFromGitHub {
13 owner = "protectai";
14 repo = "modelscan";
15 tag = "v${version}";
16 hash = "sha256-8VupkPiHebVtOqMdtkBflAI1zPRdDSvHCEq3ghjASaE=";
17 };
18
19 pythonRelaxDeps = [ "rich" ];
20
21 build-system = with python3.pkgs; [
22 poetry-core
23 poetry-dynamic-versioning
24 ];
25
26 dependencies = with python3.pkgs; [
27 click
28 numpy
29 rich
30 tomlkit
31 ];
32
33 optional-dependencies = with python3.pkgs; {
34 h5py = [ h5py ];
35 # tensorflow = [ tensorflow ];
36 };
37
38 nativeCheckInputs =
39 with python3.pkgs;
40 [
41 dill
42 pytestCheckHook
43 ]
44 ++ lib.flatten (builtins.attrValues optional-dependencies);
45
46 # tensorflow doesn0t support Python 3.12
47 doCheck = false;
48
49 pythonImportsCheck = [ "modelscan" ];
50
51 meta = with lib; {
52 description = "Protection against Model Serialization Attacks";
53 homepage = "https://github.com/protectai/modelscan";
54 changelog = "https://github.com/protectai/modelscan/releases/tag/${src.tag}";
55 license = licenses.asl20;
56 maintainers = with maintainers; [ fab ];
57 mainProgram = "modelscan";
58 };
59}