Files
nixpkgs/pkgs/development/python-modules/cmdstanpy/default.nix
Dark Steveneq 646b892680
Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
push sheeet
2025-10-09 14:15:47 +02:00

92 lines
1.9 KiB
Nix

{
lib,
buildPythonPackage,
fetchFromGitHub,
replaceVars,
cmdstan,
setuptools,
pandas,
numpy,
tqdm,
stanio,
xarray,
pytestCheckHook,
stdenv,
}:
buildPythonPackage rec {
pname = "cmdstanpy";
version = "1.2.5";
pyproject = true;
src = fetchFromGitHub {
owner = "stan-dev";
repo = "cmdstanpy";
tag = "v${version}";
hash = "sha256-/MiWawB1Y4/eMBHXQLjd+P+Pe8EtsLbGFrzQa1RNf6g=";
};
patches = [
(replaceVars ./use-nix-cmdstan-path.patch {
cmdstan = "${cmdstan}/opt/cmdstan";
})
];
postPatch = ''
# conftest.py would have used git to clean up, which is unnecessary here
rm test/conftest.py
'';
nativeBuildInputs = [
setuptools
];
propagatedBuildInputs = [
pandas
numpy
tqdm
stanio
];
optional-dependencies = {
all = [ xarray ];
};
pythonRelaxDeps = [ "stanio" ];
preCheck = ''
export HOME=$(mktemp -d)
'';
nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.all;
disabledTestPaths = [
# No need to test these when using Nix
"test/test_install_cmdstan.py"
"test/test_cxx_installation.py"
];
disabledTests = [
"test_serialization" # Pickle class mismatch errors
# These tests use the flag -DSTAN_THREADS which doesn't work in cmdstan (missing file)
"test_multi_proc_threads"
"test_compile_force"
# These tests require a writeable cmdstan source directory
"test_pathfinder_threads"
"test_save_profile"
]
++ lib.optionals stdenv.hostPlatform.isDarwin [
"test_init_types" # CmdStan error: error during processing Operation not permitted
];
pythonImportsCheck = [ "cmdstanpy" ];
meta = {
homepage = "https://github.com/stan-dev/cmdstanpy";
description = "Lightweight interface to Stan for Python users";
changelog = "https://github.com/stan-dev/cmdstanpy/releases/tag/v${version}";
license = lib.licenses.bsd3;
maintainers = with lib.maintainers; [ tomasajt ];
};
}