1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 hatchling,
7 huggingface-hub,
8 matplotlib,
9 numpy,
10 packaging,
11 pandas,
12 prettytable,
13 pytest-cov-stub,
14 pytestCheckHook,
15 pythonOlder,
16 pyyaml,
17 rich,
18 scikit-learn,
19 streamlit,
20 tabulate,
21}:
22
23buildPythonPackage rec {
24 pname = "skops";
25 version = "0.13.0";
26 pyproject = true;
27
28 src = fetchFromGitHub {
29 owner = "skops-dev";
30 repo = "skops";
31 tag = "v${version}";
32 hash = "sha256-1550LIVyChqP5q4VZmflCXPyXXg4eHJU5AlVQJD2M8c=";
33 };
34
35 build-system = [ hatchling ];
36
37 dependencies = [
38 numpy
39 packaging
40 prettytable
41 scikit-learn
42 tabulate
43 ];
44
45 nativeCheckInputs = [
46 matplotlib
47 pandas
48 pytest-cov-stub
49 pytestCheckHook
50 pyyaml
51 streamlit
52 ];
53
54 optional-dependencies = {
55 rich = [ rich ];
56 };
57
58 enabledTestPaths = [ "skops" ];
59
60 disabledTests = [
61 # flaky
62 "test_base_case_works_as_expected"
63 # fairlearn is not available in nixpkgs
64 "TestAddFairlearnMetricFrame"
65 ];
66
67 disabledTestPaths = [
68 # minor output formatting issue
69 "skops/card/_model_card.py"
70 ]
71 ++ lib.optionals stdenv.hostPlatform.isDarwin [
72 # Segfaults on darwin
73 "skops/io/tests/test_persist.py"
74 ];
75
76 pytestFlags = [
77 # Warning from scipy.optimize in skops/io/tests/test_persist.py::test_dump_and_load_with_file_wrapper
78 # https://github.com/skops-dev/skops/issues/479
79 "-Wignore::DeprecationWarning"
80 ];
81
82 pythonImportsCheck = [ "skops" ];
83
84 meta = {
85 description = "Library for saving/loading, sharing, and deploying scikit-learn based models";
86 homepage = "https://skops.readthedocs.io/en/stable";
87 changelog = "https://github.com/skops-dev/skops/releases/tag/${src.tag}";
88 license = lib.licenses.mit;
89 maintainers = [ lib.maintainers.bcdarwin ];
90 mainProgram = "skops";
91 };
92}