17 buildPythonPackage rec {
22 src = fetchFromGitHub {
25 rev = "refs/tags/v${version}";
26 hash = "sha256-SKDqLvWbzaBcL13E87kcphBJNIZfdkPp2g4SIDEKA0U=";
31 src = ./use-nix-cmdstan-path.patch;
32 cmdstan = "${cmdstan}/opt/cmdstan";
37 # conftest.py would have used git to clean up, which is unnecessary here
45 propagatedBuildInputs = [
52 optional-dependencies = {
56 pythonRelaxDeps = [ "stanio" ];
59 export HOME=$(mktemp -d)
62 nativeCheckInputs = [ pytestCheckHook ] ++ optional-dependencies.all;
65 # No need to test these when using Nix
66 "test/test_install_cmdstan.py"
67 "test/test_cxx_installation.py"
72 "test_serialization" # Pickle class mismatch errors
73 # These tests use the flag -DSTAN_THREADS which doesn't work in cmdstan (missing file)
74 "test_multi_proc_threads"
76 # These tests require a writeable cmdstan source directory
77 "test_pathfinder_threads"
80 ++ lib.optionals stdenv.hostPlatform.isDarwin [
81 "test_init_types" # CmdStan error: error during processing Operation not permitted
84 pythonImportsCheck = [ "cmdstanpy" ];
87 homepage = "https://github.com/stan-dev/cmdstanpy";
88 description = "Lightweight interface to Stan for Python users";
89 changelog = "https://github.com/stan-dev/cmdstanpy/releases/tag/v${version}";
90 license = lib.licenses.bsd3;
91 maintainers = with lib.maintainers; [ tomasajt ];