aboutsummaryrefslogtreecommitdiffhomepage
path: root/tensorflow/tools/pip_package
diff options
context:
space:
mode:
Diffstat (limited to 'tensorflow/tools/pip_package')
-rw-r--r--tensorflow/tools/pip_package/BUILD27
-rw-r--r--tensorflow/tools/pip_package/MANIFEST.in3
-rw-r--r--tensorflow/tools/pip_package/README1
-rwxr-xr-xtensorflow/tools/pip_package/build_pip_package.sh38
-rw-r--r--tensorflow/tools/pip_package/setup.py79
-rw-r--r--tensorflow/tools/pip_package/simple_console.py14
6 files changed, 162 insertions, 0 deletions
diff --git a/tensorflow/tools/pip_package/BUILD b/tensorflow/tools/pip_package/BUILD
new file mode 100644
index 0000000000..1302553e8d
--- /dev/null
+++ b/tensorflow/tools/pip_package/BUILD
@@ -0,0 +1,27 @@
+# Description:
+# Tools for building the TensorFlow pip package.
+
+package(default_visibility = ["//visibility:private"])
+
+py_binary(
+ name = "simple_console",
+ srcs = ["simple_console.py"],
+ deps = ["//tensorflow:tensorflow_py"],
+)
+
+sh_binary(
+ name = "build_pip_package",
+ srcs = ["build_pip_package.sh"],
+ data = [
+ "MANIFEST.in",
+ "README",
+ "setup.py",
+ ":simple_console",
+ "//tensorflow:tensorflow_py",
+ "//tensorflow/models/image/cifar10:cifar10_eval",
+ "//tensorflow/models/image/cifar10:cifar10_train",
+ "//tensorflow/models/image/cifar10:cifar10_multi_gpu_train",
+ "//tensorflow/models/image/mnist:convolutional",
+ "//tensorflow/tensorboard",
+ ],
+)
diff --git a/tensorflow/tools/pip_package/MANIFEST.in b/tensorflow/tools/pip_package/MANIFEST.in
new file mode 100644
index 0000000000..a267dd1c76
--- /dev/null
+++ b/tensorflow/tools/pip_package/MANIFEST.in
@@ -0,0 +1,3 @@
+include README
+recursive-include * *.py
+recursive-include * *.so
diff --git a/tensorflow/tools/pip_package/README b/tensorflow/tools/pip_package/README
new file mode 100644
index 0000000000..72e19becbb
--- /dev/null
+++ b/tensorflow/tools/pip_package/README
@@ -0,0 +1 @@
+TensorFlow
diff --git a/tensorflow/tools/pip_package/build_pip_package.sh b/tensorflow/tools/pip_package/build_pip_package.sh
new file mode 100755
index 0000000000..71317d34a5
--- /dev/null
+++ b/tensorflow/tools/pip_package/build_pip_package.sh
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+set -e
+
+function main() {
+ if [ $# -lt 1 ] ; then
+ echo "No destination dir provided"
+ exit 1
+ fi
+
+ DEST=$1
+ TMPDIR=$(mktemp -d -t tmp.XXXXXXXXXX)
+
+ echo `date` : "=== Using tmpdir: ${TMPDIR}"
+
+ if [ ! -d bazel-bin/tensorflow ]; then
+ echo "Could not find bazel-bin. Did you run from the root of the build tree?"
+ exit 1
+ fi
+ cp -R \
+ bazel-bin/tensorflow/tools/pip_package/build_pip_package.runfiles/* \
+ ${TMPDIR}
+
+ cp tensorflow/tools/pip_package/MANIFEST.in ${TMPDIR}
+ cp tensorflow/tools/pip_package/README ${TMPDIR}
+ cp tensorflow/tools/pip_package/setup.py ${TMPDIR}
+ pushd ${TMPDIR}
+ rm -f MANIFEST
+ echo `date` : "=== Building wheel"
+ python setup.py sdist bdist_wheel >/dev/null
+ mkdir -p ${DEST}
+ cp dist/* ${DEST}
+ popd
+ rm -rf ${TMPDIR}
+ echo `date` : "=== Output wheel file is in: ${DEST}"
+}
+
+main "$@"
diff --git a/tensorflow/tools/pip_package/setup.py b/tensorflow/tools/pip_package/setup.py
new file mode 100644
index 0000000000..e7f9ecdc71
--- /dev/null
+++ b/tensorflow/tools/pip_package/setup.py
@@ -0,0 +1,79 @@
+import fnmatch
+import os
+from setuptools import find_packages, setup, Extension
+from setuptools.dist import Distribution
+
+_VERSION = '0.5.0'
+
+REQUIRED_PACKAGES = [
+ 'numpy',
+ 'six >= 1.10.0',
+ 'virtualenvwrapper',
+]
+
+# pylint: disable=line-too-long
+CONSOLE_SCRIPTS = [
+ 'tensorboard = tensorflow.tensorboard.tensorboard:main',
+ 'tensorflow_model_cifar10_train = tensorflow.models.image.cifar10.cifar10_train:main',
+ 'tensorflow_model_cifar10_multi_gpu_train = tensorflow.models.image.cifar10.cifar10_multi_gpu_train:main',
+ 'tensorflow_model_cifar10_eval = tensorflow.models.image.cifar10.cifar10_eval:main',
+ 'tensorflow_model_mnist_convolutional = tensorflow.models.image.mnist.convolutional:main',
+]
+# pylint: enable=line-too-long
+
+TEST_PACKAGES = [
+ 'scipy >= 0.15.1',
+]
+
+class BinaryDistribution(Distribution):
+ def is_pure(self):
+ return False
+
+matches = []
+for root, dirnames, filenames in os.walk('external'):
+ for filename in fnmatch.filter(filenames, '*'):
+ matches.append(os.path.join(root, filename))
+
+matches = ['../' + x for x in matches if '.py' not in x]
+
+setup(
+ name='tensorflow',
+ version=_VERSION,
+ description='TensorFlow helps the tensors flow',
+ long_description='',
+ url='http://tensorflow.com/',
+ author='Google Inc.',
+ author_email='opensource@google.com',
+ # Contained modules and scripts.
+ packages=find_packages(),
+ entry_points={
+ 'console_scripts': CONSOLE_SCRIPTS,
+ },
+ install_requires=REQUIRED_PACKAGES,
+ tests_require=REQUIRED_PACKAGES + TEST_PACKAGES,
+ # Add in any packaged data.
+ include_package_data=True,
+ package_data={
+ 'tensorflow': ['python/_pywrap_tensorflow.so',
+ 'tensorboard/dist/index.html',
+ 'tensorboard/dist/tf-tensorboard.html',
+ 'tensorboard/lib/css/global.css',
+ ] + matches,
+ },
+ zip_safe=False,
+ distclass=BinaryDistribution,
+ # PyPI package information.
+ classifiers=[
+ 'Development Status :: 4 - Beta',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: Education',
+ 'Intended Audience :: Science/Research',
+ 'License :: OSI Approved :: Apache Software License',
+ 'Programming Language :: Python :: 2.7',
+ 'Topic :: Scientific/Engineering :: Mathematics',
+ 'Topic :: Software Development :: Libraries :: Python Modules',
+ 'Topic :: Software Development :: Libraries',
+ ],
+ license='Apache 2.0',
+ keywords='tensorflow tensor machine learning',
+ )
diff --git a/tensorflow/tools/pip_package/simple_console.py b/tensorflow/tools/pip_package/simple_console.py
new file mode 100644
index 0000000000..b2fdc739e7
--- /dev/null
+++ b/tensorflow/tools/pip_package/simple_console.py
@@ -0,0 +1,14 @@
+"""Start a simple interactive console with TensorFlow available."""
+
+import code
+import sys
+
+
+def main(_):
+ """Run an interactive console."""
+ code.interact()
+ return 0
+
+
+if __name__ == '__main__':
+ sys.exit(main(sys.argv))