1 # Maintainer: Konstantin Gizdov <arch at kge dot pw>
3 _pkgbase=tensorboard_plugin_wit
4 pkgbase="python-${_pkgbase}"
5 pkgname=("python-${_pkgbase}" python-witwidget)
6 _bzlver=3.6.0 # latest Bazel that is supported for building
7 pkgdesc='The What-If Tool (WIT): An easy-to-use interface for expanding understanding of a black-box classification or regression ML model.'
8 url='https://pair-code.github.io/what-if-tool'
13 source=("${_pkgbase}-${pkgver}::git+https://github.com/PAIR-code/what-if-tool#tag=v${pkgver}"
14 "https://github.com/bazelbuild/bazel/releases/download/${_bzlver}/bazel-${_bzlver}-linux-x86_64"{,.sig}
16 _common_depends=('python-google-api-python-client' 'python-ipywidgets')
17 makedepends=('git' 'npm' 'python-virtualenv' 'python-setuptools-scm' 'python-build' 'python-installer' 'python-wheel' "${_common_depends[@]}")
18 validpgpkeys=('71A1D0EFCFEB6281FD0437C93D5919B448457EE0') # "Bazel Developer (Bazel APT repository key) <bazel-dev@googlegroups.com>"
19 depends=('python-werkzeug' 'tensorboard')
21 'cfe73c0b3f5e54fa65b034cb8fd4e54976126e9af09dba6ea3fa3f5e32be4909908bd0ec95f162f30cdde67855bc4d8d5a8ffebd959e01238b586f9b0fd763ae'
23 'ffc30dd67139e2e915f6a227ac5e27b3770019a5c83b0d729442a141eb48e389493285f2389e1cf161807d80ac107a79afd91eb148af8d6188dced5233f5709d')
26 python -c 'import sys; print(str(sys.version_info[0]) + "." + str(sys.version_info[1]))'
30 echo "${srcdir}/bazel-${_bzlver}-local-binary"
34 cp "${srcdir}/bazel-${_bzlver}-linux-x86_64" "$(_bzlcmd)"
36 cd "${srcdir}/${_pkgbase}-${pkgver}"
37 sed -e "s@version=\"1.8.0\"@version=\"${pkgver}\"@g" \
38 -i tensorboard_plugin_wit/pip_package/setup.py
39 sed -e 's@/tmp/wit-pip@${BUILD_WORKSPACE_DIRECTORY}/wit-pip@g' \
40 -e '/pip install -qU wheel/d' \
41 -i tensorboard_plugin_wit/pip_package/build_pip_package.sh \
42 witwidget/pip_package/build_pip_package.sh
44 patch -Np1 -i "${srcdir}/add_zlib.patch"
48 cd "${srcdir}/${_pkgbase}-${pkgver}"
49 "$(_bzlcmd)" --output_user_root "${srcdir}/build-plugin" run --incompatible_restrict_string_escapes=false tensorboard_plugin_wit/pip_package:build_pip_package
51 cd "${srcdir}/${_pkgbase}-${pkgver}"
52 "$(_bzlcmd)" --output_user_root "${srcdir}/build-witwidget" run --incompatible_restrict_string_escapes=false witwidget/pip_package:build_pip_package
55 package_python-tensorboard_plugin_wit() {
56 provides=('tensorboard_plugin_wit')
57 optdepends=('python-tensorflow-serving-api: TensorFlow Classification, Regression, or Predict APIs')
58 local _pyver="$(get_pyver)"
59 cd "${srcdir}/${_pkgbase}-${pkgver}"
60 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
61 python -m installer --destdir="$pkgdir" wit-pip/release/dist/tensorboard_plugin_wit-${pkgver}-py3*.whl
63 package_python-witwidget() {
64 pkgdesc='What-If Tool Notebook Widget.'
65 provides=('witwidget' 'witwidget-gpu')
66 depends=("${_common_depends[@]}" 'python-tensorboard_plugin_wit')
68 'python-tensorflow-serving-api: browse model thorugh TensorFlow Serving API'
69 'python-tensorflow-estimator: browse model as a TensorFlow Estimator feature spec'
71 local _pyver="$(get_pyver)"
72 cd "${srcdir}/${_pkgbase}-${pkgver}"
73 install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
74 python -m installer --destdir="$pkgdir" wit-pip/release/dist/witwidget-${pkgver}-py3*.whl
75 rm -rf "${pkgdir}/usr/lib/python${_pyver}/site-packages/${_pkgbase}"
76 install -d "${pkgdir}/etc/jupyter/nbconfig/notebook.d"
77 mv "${pkgdir}/usr/etc/jupyter/nbconfig/notebook.d/wit-widget.json" "${pkgdir}/etc/jupyter/nbconfig/notebook.d/wit-widget.json"
78 rm -rf "${pkgdir}/usr/etc"