Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 buildPythonPackage, 4 pythonOlder, 5 fetchFromGitHub, 6 makefun, 7 multipledispatch, 8 numpy, 9 opt-einsum, 10 typing-extensions, 11 pyro-ppl, 12 torch, 13 pandas, 14 pillow, 15 pyro-api, 16 pytest, 17 pytest-xdist, 18 requests, 19 scipy, 20 torchvision, 21}: 22 23buildPythonPackage rec { 24 pname = "funsor"; 25 version = "0.4.6"; 26 format = "setuptools"; 27 28 disabled = pythonOlder "3.7"; 29 30 src = fetchFromGitHub { 31 owner = "pyro-ppl"; 32 repo = "funsor"; 33 rev = "refs/tags/${version}"; 34 hash = "sha256-Prj1saT0yoPAP8rDE0ipBEpR3QMk4PS12VSJlxc22p8="; 35 }; 36 37 # Disable the tests that rely on downloading assets from the internet as well as the linting checks. 38 patches = [ ./patch-makefile-for-tests.patch ]; 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}