1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 pythonOlder,
5 lib,
6 cmake,
7 setuptools,
8 typing-extensions,
9 pybind11,
10 pytestCheckHook,
11}:
12
13buildPythonPackage rec {
14 pname = "optree";
15 version = "0.14.1";
16 pyproject = true;
17
18 disabled = pythonOlder "3.7";
19
20 src = fetchFromGitHub {
21 owner = "metaopt";
22 repo = "optree";
23 tag = "v${version}";
24 hash = "sha256-5PIe/mXPNohwM0oNT/zSPmNUycjXuujtIFCki5t7V1I=";
25 };
26
27 dontUseCmakeConfigure = true;
28
29 propagatedBuildInputs = [ typing-extensions ];
30 nativeBuildInputs = [
31 setuptools
32 pybind11
33 cmake
34 ];
35
36 nativeCheckInputs = [ pytestCheckHook ];
37 # prevent import failures from pytest
38 preCheck = ''
39 rm -r optree
40 '';
41 disabledTests = [
42 # Fails because the 'test_treespec' module can't be found
43 "test_treespec_pickle_missing_registration"
44 ];
45 pythonImportsCheck = [ "optree" ];
46
47 meta = {
48 description = "Optimized PyTree Utilities";
49 homepage = "https://github.com/metaopt/optree";
50 changelog = "https://github.com/metaopt/optree/releases";
51 license = lib.licenses.asl20;
52 maintainers = with lib.maintainers; [ pandapip1 ];
53 };
54}