1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, makefun
6, multipledispatch
7, numpy
8, opt-einsum
9, typing-extensions
10, pyro-ppl
11, torch
12, pandas
13, pillow
14, pyro-api
15, pytest
16, pytest-xdist
17, requests
18, scipy
19, torchvision
20}:
21
22buildPythonPackage rec {
23 pname = "funsor";
24 version = "0.4.6";
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "pyro-ppl";
30 repo = "funsor";
31 rev = "refs/tags/${version}";
32 hash = "sha256-Prj1saT0yoPAP8rDE0ipBEpR3QMk4PS12VSJlxc22p8=";
33 };
34
35 # Disable the tests that rely on downloading assets from the internet as well as the linting checks.
36 patches = [
37 ./patch-makefile-for-tests.patch
38 ];
39
40 propagatedBuildInputs = [
41 makefun
42 multipledispatch
43 numpy
44 opt-einsum
45 typing-extensions
46 ];
47
48 nativeCheckInputs = [
49 # Backend
50 pyro-ppl
51 torch
52
53 pandas
54 pillow
55 pyro-api
56 pytest
57 pytest-xdist
58 requests
59 scipy
60 torchvision
61 ];
62
63 # Use the included Makefile to run the tests.
64 checkPhase = ''
65 export FUNSOR_BACKEND=torch
66 make test
67 '';
68
69 pythonImportsCheck = [ "funsor" ];
70
71 meta = with lib; {
72 description = "Functional tensors for probabilistic programming";
73 homepage = "https://funsor.pyro.ai";
74 changelog = "https://github.com/pyro-ppl/funsor/releases/tag/${version}";
75 license = licenses.asl20;
76 maintainers = with maintainers; [ GaetanLepage ];
77 };
78}