Merge pull request #335471 from GaetanLepage/funsor

python311Packages.funsor: fix on both linux and darwin
This commit is contained in:
Gaétan Lepage
2024-08-21 15:18:25 +02:00
committed by GitHub
2 changed files with 32 additions and 39 deletions
@@ -3,27 +3,36 @@
buildPythonPackage,
pythonOlder,
fetchFromGitHub,
# build-system
setuptools,
# dependencies
makefun,
multipledispatch,
numpy,
opt-einsum,
typing-extensions,
# checks
pyro-ppl,
torch,
pandas,
pillow,
pyro-api,
pytest,
pytestCheckHook,
pytest-xdist,
requests,
scipy,
torchvision,
stdenv,
}:
buildPythonPackage rec {
pname = "funsor";
version = "0.4.6";
format = "setuptools";
pyproject = true;
disabled = pythonOlder "3.7";
@@ -34,10 +43,9 @@ buildPythonPackage rec {
hash = "sha256-Prj1saT0yoPAP8rDE0ipBEpR3QMk4PS12VSJlxc22p8=";
};
# Disable the tests that rely on downloading assets from the internet as well as the linting checks.
patches = [ ./patch-makefile-for-tests.patch ];
build-system = [ setuptools ];
propagatedBuildInputs = [
dependencies = [
makefun
multipledispatch
numpy
@@ -53,26 +61,38 @@ buildPythonPackage rec {
pandas
pillow
pyro-api
pytest
pytestCheckHook
pytest-xdist
requests
scipy
torchvision
];
# Use the included Makefile to run the tests.
checkPhase = ''
preCheck = ''
export FUNSOR_BACKEND=torch
make test
'';
pythonImportsCheck = [ "funsor" ];
meta = with lib; {
disabledTests =
[
# `test_torch_save` got broken by the update of torch (2.3.1 -> 2.4.0):
# FutureWarning: You are using `torch.load` with `weights_only=False`...
# TODO: Try to re-enable this test at next release
"test_torch_save"
]
++ lib.optionals stdenv.isDarwin [
# Failures related to JIT
# RuntimeError: required keyword attribute 'Subgraph' has the wrong type
"test_local_param_ok"
"test_plate_ok"
];
meta = {
description = "Functional tensors for probabilistic programming";
homepage = "https://funsor.pyro.ai";
changelog = "https://github.com/pyro-ppl/funsor/releases/tag/${version}";
license = licenses.asl20;
maintainers = with maintainers; [ GaetanLepage ];
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ GaetanLepage ];
};
}
@@ -1,27 +0,0 @@
diff --git a/Makefile b/Makefile
index d4b862c..755dfe3 100644
--- a/Makefile
+++ b/Makefile
@@ -23,7 +23,7 @@ format: license FORCE
black .
isort .
-test: lint FORCE
+test: FORCE
ifeq (${FUNSOR_BACKEND}, torch)
pytest -v -n auto test/
FUNSOR_DEBUG=1 pytest -v test/test_gaussian.py
@@ -45,10 +45,10 @@ ifeq (${FUNSOR_BACKEND}, torch)
python examples/slds.py -n 2 -t 50
python examples/pcfg.py --size 3
python examples/talbot.py -n 2
- python examples/vae.py --smoke-test
+ # python examples/vae.py --smoke-test
python examples/eeg_slds.py --num-steps 2 --fon --test
- python examples/mixed_hmm/experiment.py -d seal -i discrete -g discrete -zi --smoke
- python examples/mixed_hmm/experiment.py -d seal -i discrete -g discrete -zi --parallel --smoke
+ # python examples/mixed_hmm/experiment.py -d seal -i discrete -g discrete -zi --smoke
+ # python examples/mixed_hmm/experiment.py -d seal -i discrete -g discrete -zi --parallel --smoke
python examples/sensor.py --seed=0 --num-frames=2 -n 1
python examples/adam.py --num-steps=21
@echo PASS