2024-06-05 15:53:02 +00:00
|
|
|
{
|
|
|
|
stdenv,
|
|
|
|
buildPythonPackage,
|
|
|
|
fetchFromGitHub,
|
|
|
|
pythonOlder,
|
|
|
|
lib,
|
|
|
|
cmake,
|
|
|
|
setuptools,
|
|
|
|
typing-extensions,
|
|
|
|
pybind11,
|
|
|
|
pytestCheckHook,
|
2024-05-15 15:35:15 +00:00
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "optree";
|
|
|
|
version = "0.11.0";
|
|
|
|
pyproject = true;
|
|
|
|
|
|
|
|
disabled = pythonOlder "3.7";
|
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "metaopt";
|
|
|
|
repo = pname;
|
|
|
|
rev = "v${version}";
|
|
|
|
hash = "sha256-VnnnEoXkYJO+S7baH+JZvsW18Tk3TiY9+Cd230OlZWo=";
|
|
|
|
};
|
|
|
|
|
|
|
|
dontUseCmakeConfigure = true;
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
propagatedBuildInputs = [ typing-extensions ];
|
2024-05-15 15:35:15 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
setuptools
|
|
|
|
pybind11
|
|
|
|
cmake
|
|
|
|
];
|
|
|
|
|
2024-06-05 15:53:02 +00:00
|
|
|
nativeCheckInputs = [ pytestCheckHook ];
|
2024-05-15 15:35:15 +00:00
|
|
|
# prevent import failures from pytest
|
|
|
|
preCheck = ''
|
|
|
|
rm -r optree
|
|
|
|
'';
|
|
|
|
disabledTests = [
|
|
|
|
# Fails because the 'test_treespec' module can't be found
|
|
|
|
"test_treespec_pickle_missing_registration"
|
|
|
|
];
|
2024-06-05 15:53:02 +00:00
|
|
|
pythonImportsCheck = [ "optree" ];
|
2024-05-15 15:35:15 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://github.com/metaopt/optree";
|
|
|
|
changelog = "https://github.com/metaopt/optree/releases/tag/v${version}";
|
|
|
|
description = "Optimized PyTree Utilities";
|
|
|
|
maintainers = with maintainers; [ pandapip1 ];
|
|
|
|
license = licenses.asl20;
|
|
|
|
};
|
|
|
|
}
|