1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 rustPlatform,
7
8 # build-system
9 cargo,
10 rustc,
11
12 # buildInputs
13 libiconv,
14
15 # dependencies
16 arviz,
17 pandas,
18 pyarrow,
19 xarray,
20
21 # tests
22 # bridgestan, (not packaged)
23 jax,
24 jaxlib,
25 numba,
26 pymc,
27 pytestCheckHook,
28 setuptools,
29}:
30
31buildPythonPackage rec {
32 pname = "nutpie";
33 version = "0.13.2";
34 pyproject = true;
35
36 src = fetchFromGitHub {
37 owner = "pymc-devs";
38 repo = "nutpie";
39 rev = "refs/tags/v${version}";
40 hash = "sha256-XyUMCnHm5V7oFaf3W+nGpcHfq1ZFppeGMIMCU5OB87s=";
41 };
42
43 cargoDeps = rustPlatform.fetchCargoTarball {
44 inherit src;
45 name = "${pname}-${version}";
46 hash = "sha256-9lM1S42Bmnlb0opstZN2aOKYhBnP87Frq+fQxk0ez+c=";
47 };
48
49 build-system = [
50 cargo
51 rustPlatform.bindgenHook
52 rustPlatform.cargoSetupHook
53 rustPlatform.maturinBuildHook
54 rustc
55 ];
56
57 buildInputs = lib.optionals stdenv.hostPlatform.isDarwin [
58 libiconv
59 ];
60
61 dependencies = [
62 arviz
63 pandas
64 pyarrow
65 xarray
66 ];
67
68 pythonImportsCheck = [ "nutpie" ];
69
70 nativeCheckInputs = [
71 # bridgestan
72 numba
73 jax
74 jaxlib
75 pymc
76 pytestCheckHook
77 setuptools
78 ];
79
80 disabledTestPaths = [
81 # Require unpackaged bridgestan
82 "tests/test_stan.py"
83
84 # KeyError: "duplicate registration for <class 'numba.core.types.misc.SliceType'>"
85 "tests/test_pymc.py"
86 ];
87
88 # Currently, no test are working...
89 doCheck = false;
90
91 meta = {
92 description = "Python wrapper for nuts-rs";
93 homepage = "https://github.com/pymc-devs/nutpie";
94 changelog = "https://github.com/pymc-devs/nutpie/blob/${src.rev}/CHANGELOG.md";
95 license = lib.licenses.mit;
96 maintainers = with lib.maintainers; [ GaetanLepage ];
97 };
98}