1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 apricot-select,
12 networkx,
13 numpy,
14 scikit-learn,
15 scipy,
16 torch,
17
18 # tests
19 pytestCheckHook,
20}:
21
22buildPythonPackage rec {
23 pname = "pomegranate";
24 version = "1.1.0";
25 pyproject = true;
26
27 src = fetchFromGitHub {
28 repo = pname;
29 owner = "jmschrei";
30 tag = "v${version}";
31 hash = "sha256-p2Gn0FXnsAHvRUeAqx4M1KH0+XvDl3fmUZZ7MiMvPSs=";
32 };
33
34 build-system = [ setuptools ];
35
36 dependencies = [
37 apricot-select
38 networkx
39 numpy
40 scikit-learn
41 scipy
42 torch
43 ];
44
45 pythonImportsCheck = [ "pomegranate" ];
46
47 nativeCheckInputs = [
48 pytestCheckHook
49 ];
50
51 pytestFlagsArray = lib.optionals (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64) [
52 # AssertionError: Arrays are not almost equal to 6 decimals
53 "--deselect=tests/distributions/test_normal_full.py::test_fit"
54 "--deselect=tests/distributions/test_normal_full.py::test_from_summaries"
55 "--deselect=tests/distributions/test_normal_full.py::test_serialization"
56 ];
57
58 disabledTests = [
59 # AssertionError: Arrays are not almost equal to 6 decimals
60 "test_sample"
61 ];
62
63 meta = {
64 description = "Probabilistic and graphical models for Python, implemented in cython for speed";
65 homepage = "https://github.com/jmschrei/pomegranate";
66 changelog = "https://github.com/jmschrei/pomegranate/releases/tag/v${version}";
67 license = lib.licenses.mit;
68 maintainers = with lib.maintainers; [ rybern ];
69 };
70}