about summary refs log tree commit diff
path: root/pkgs/development/python-modules/tensorflow-metadata
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/python-modules/tensorflow-metadata')
-rw-r--r--pkgs/development/python-modules/tensorflow-metadata/build.patch24
-rw-r--r--pkgs/development/python-modules/tensorflow-metadata/default.nix46
2 files changed, 70 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/tensorflow-metadata/build.patch b/pkgs/development/python-modules/tensorflow-metadata/build.patch
new file mode 100644
index 0000000000000..ff81c5d1e86cf
--- /dev/null
+++ b/pkgs/development/python-modules/tensorflow-metadata/build.patch
@@ -0,0 +1,24 @@
+diff --git a/setup.py b/setup.py
+index 7a09b2f..94c5aa6 100644
+--- a/setup.py
++++ b/setup.py
+@@ -125,7 +125,7 @@ setup(
+     ],
+     namespace_packages=[],
+     install_requires=[
+-        'absl-py>=0.9,<0.13',
++        'absl-py>=0.9',
+         'googleapis-common-protos>=1.52.0,<2',
+         'protobuf>=3.13,<4',
+     ],
+@@ -137,8 +137,5 @@ setup(
+     long_description_content_type='text/markdown',
+     keywords='tensorflow metadata tfx',
+     download_url='https://github.com/tensorflow/metadata/tags',
+-    requires=[],
+-    cmdclass={
+-        'build': _BuildCommand,
+-        'bazel_build': _BazelBuildCommand,
+-    })
++    requires=[]
++    )
diff --git a/pkgs/development/python-modules/tensorflow-metadata/default.nix b/pkgs/development/python-modules/tensorflow-metadata/default.nix
new file mode 100644
index 0000000000000..2a80155c4cd9e
--- /dev/null
+++ b/pkgs/development/python-modules/tensorflow-metadata/default.nix
@@ -0,0 +1,46 @@
+{ absl-py
+, buildPythonPackage
+, fetchFromGitHub
+, googleapis-common-protos
+, lib
+}:
+
+buildPythonPackage rec {
+  pname = "tensorflow-metadata";
+  version = "1.5.0";
+
+  src = fetchFromGitHub {
+    owner = "tensorflow";
+    repo = "metadata";
+    rev = "v${version}";
+    sha256 = "17p74k6rwswpmj7m16cw9hdam6b4m7v5bahirmc2l1kwfvrn4w33";
+  };
+
+  patches = [
+    ./build.patch
+  ];
+
+  # Default build pulls in Bazel + extra deps, given the actual build
+  # is literally three lines (see below) - replace it with custom build.
+  preBuild = ''
+    for proto in tensorflow_metadata/proto/v0/*.proto; do
+      protoc --python_out=. $proto
+    done
+  '';
+
+  propagatedBuildInputs = [
+    absl-py
+    googleapis-common-protos
+  ];
+
+  pythonImportsCheck = [
+    "tensorflow_metadata"
+  ];
+
+  meta = with lib; {
+    description = "Standard representations for metadata that are useful when training machine learning models with TensorFlow";
+    homepage = "https://github.com/tensorflow/metadata";
+    license = licenses.asl20;
+    maintainers = with maintainers; [ ndl ];
+  };
+}