1{
2 absl-py,
3 buildPythonPackage,
4 fetchFromGitHub,
5 googleapis-common-protos,
6 protobuf,
7 lib,
8}:
9
10buildPythonPackage rec {
11 pname = "tensorflow-metadata";
12 version = "1.14.0";
13 format = "setuptools";
14
15 src = fetchFromGitHub {
16 owner = "tensorflow";
17 repo = "metadata";
18 rev = "refs/tags/v${version}";
19 hash = "sha256-ZfX25CaV+tZVdas+n7O6Gqv1GxOP1iwippIXxfhcOfg=";
20 };
21
22 patches = [ ./build.patch ];
23
24 postPatch = ''
25 substituteInPlace setup.py \
26 --replace 'protobuf>=3.13,<4' 'protobuf>=3.13'
27 '';
28
29 # Default build pulls in Bazel + extra deps, given the actual build
30 # is literally three lines (see below) - replace it with custom build.
31 preBuild = ''
32 for proto in tensorflow_metadata/proto/v0/*.proto; do
33 protoc --python_out=. $proto
34 done
35 '';
36
37 propagatedBuildInputs = [
38 absl-py
39 googleapis-common-protos
40 protobuf
41 ];
42
43 # has no tests
44 doCheck = false;
45
46 pythonImportsCheck = [ "tensorflow_metadata" ];
47
48 meta = with lib; {
49 description = "Standard representations for metadata that are useful when training machine learning models with TensorFlow";
50 homepage = "https://github.com/tensorflow/metadata";
51 license = licenses.asl20;
52 maintainers = with maintainers; [ ndl ];
53 };
54}