Files
2026-04-07 08:42:20 +00:00

106 lines
2.0 KiB
Nix

{
lib,
stdenv,
buildPythonPackage,
fetchFromGitHub,
# build-system
setuptools,
setuptools-scm,
# dependencies
jax,
jaxlib,
numpy,
optax,
scipy,
typing-extensions,
# optional-dependencies
fastprogress,
# checks
chex,
pytest-xdist,
pytestCheckHook,
}:
buildPythonPackage (finalAttrs: {
pname = "blackjax";
version = "1.5";
pyproject = true;
src = fetchFromGitHub {
owner = "blackjax-devs";
repo = "blackjax";
tag = finalAttrs.version;
hash = "sha256-tKJfukTqSiW2Xg3/8DakxtxlwGpJ14S/7qUE1OGM97I=";
};
build-system = [
setuptools
setuptools-scm
];
dependencies = [
jax
jaxlib
numpy
optax
scipy
typing-extensions
];
optional-dependencies = {
progress = [
fastprogress
];
};
nativeCheckInputs = [
chex
pytestCheckHook
pytest-xdist
]
++ finalAttrs.passthru.optional-dependencies.progress;
disabledTestPaths = [
"tests/test_benchmarks.py"
# Assertion errors on numerical values
"tests/mcmc/test_integrators.py"
];
disabledTests = [
# too slow
"test_adaptive_tempered_smc"
# AssertionError on numerical values
"test_barker"
"test_mclmc"
"test_mcse4"
"test_mean_and_std"
"test_normal_univariate"
"test_nuts__with_device"
"test_nuts__with_jit"
"test_nuts__without_device"
"test_nuts__without_jit"
"test_smc__with_jit"
"test_smc_waste_free__with_jit"
]
++ lib.optionals (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64) [
# AssertionError: Not equal to tolerance rtol=1e-07, atol=1e-05
"test_equal_matrices"
];
pythonImportsCheck = [ "blackjax" ];
meta = {
homepage = "https://blackjax-devs.github.io/blackjax";
description = "Sampling library designed for ease of use, speed and modularity";
changelog = "https://github.com/blackjax-devs/blackjax/releases/tag/${finalAttrs.src.tag}";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ bcdarwin ];
};
})