1{
2 buildPythonPackage,
3 fetchFromGitHub,
4 fetchpatch,
5 jax,
6 jaxlib,
7 lib,
8 poetry-core,
9}:
10
11buildPythonPackage rec {
12 pname = "treeo";
13 # Note that there is a version 0.4.0, but it was released in error. At the
14 # time of writing (2022-03-29), v0.0.11 is the latest as reported on GitHub
15 # and PyPI.
16 version = "0.4.0";
17 format = "pyproject";
18
19 src = fetchFromGitHub {
20 owner = "cgarciae";
21 repo = "treeo";
22 tag = version;
23 hash = "sha256-0py7sKjq6WqdsZwTq61jqaIbULTfwtpz29TTpt8M2Zw=";
24 };
25
26 # See https://github.com/cgarciae/treex/issues/68.
27 patches = [
28 (fetchpatch {
29 url = "https://github.com/cgarciae/treeo/pull/14/commits/022915da2b3bf76406a7c79d1b4593bee7956f16.patch";
30 hash = "sha256-WGxJqqrf2g0yZe30RyG1xxbloiqj1awuf1Y4eh5y+z0=";
31 })
32 (fetchpatch {
33 url = "https://github.com/cgarciae/treeo/pull/14/commits/99f9488bd0c977780844fd79743167b0010d359b.patch";
34 hash = "sha256-oKDYs+Ah0QXkhiJysIudQ6VLIiUiIcnQisxYp6GJuTc=";
35 })
36 ];
37
38 nativeBuildInputs = [ poetry-core ];
39
40 # jax is not declared in the dependencies, but is necessary.
41 propagatedBuildInputs = [ jax ];
42
43 nativeCheckInputs = [ jaxlib ];
44 pythonImportsCheck = [ "treeo" ];
45
46 meta = with lib; {
47 description = "Small library for creating and manipulating custom JAX Pytree classes";
48 homepage = "https://github.com/cgarciae/treeo";
49 license = licenses.mit;
50 maintainers = with maintainers; [ ndl ];
51 # obsolete as of 2023-02-27 and not updated for more than a year as of 2023-08
52 broken = true;
53 };
54}