1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 absl-py,
11 googleapis-common-protos,
12 protobuf,
13}:
14
15buildPythonPackage rec {
16 pname = "tensorflow-metadata";
17 version = "1.17.1";
18 pyproject = true;
19
20 src = fetchFromGitHub {
21 owner = "tensorflow";
22 repo = "metadata";
23 tag = "v${version}";
24 hash = "sha256-/jVAGt3nKPwVk+poXzQ9tVCi9HEZENrbjeN4dcOfWeo=";
25 };
26
27 patches = [ ./build.patch ];
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 build-system = [ setuptools ];
38
39 pythonRelaxDeps = [
40 "protobuf"
41 ];
42
43 dependencies = [
44 absl-py
45 googleapis-common-protos
46 protobuf
47 ];
48
49 # has no tests
50 doCheck = false;
51
52 pythonImportsCheck = [
53 "tensorflow_metadata"
54 "tensorflow_metadata.proto.v0"
55 "google.protobuf.runtime_version"
56 ];
57
58 meta = {
59 description = "Standard representations for metadata that are useful when training machine learning models with TensorFlow";
60 homepage = "https://github.com/tensorflow/metadata";
61 changelog = "https://github.com/tensorflow/metadata/releases/tag/v${version}";
62 license = lib.licenses.asl20;
63 maintainers = with lib.maintainers; [ ndl ];
64 };
65}