diff --git a/build_pip_package.sh b/build_pip_package.sh new file mode 100755 index 0000000..ddf3161 --- /dev/null +++ b/build_pip_package.sh @@ -0,0 +1,50 @@ +#!/usr/bin/env bash +# Copyright 2020, The TensorFlow Privacy Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Tool to build the TensorFlow Privacy pip package. +# +# Usage: +# bazel run //tensorflow_privacy/tools/development:build_pip_package -- \ +# "/tmp/tensorflow_privacy" +# +# Arguments: +# output_dir: An output directory. +set -e + +die() { + echo >&2 "$@" + exit 1 +} + +main() { + local output_dir="$1" + + if [[ ! -d "${output_dir}" ]]; then + die "The output directory '${output_dir}' does not exist." + fi + + # Create a virtual environment + virtualenv --python=python3 "venv" + source "venv/bin/activate" + pip install --upgrade pip + + # Build pip package + pip install --upgrade setuptools wheel + python "setup.py" sdist bdist_wheel + + cp "dist/"* "${output_dir}" +} + +main "$@" diff --git a/setup.py b/setup.py index 4d23efe..388f720 100644 --- a/setup.py +++ b/setup.py @@ -17,7 +17,7 @@ from setuptools import setup setup( name='tensorflow_privacy', - version='0.3.0', + version='0.4.0', url='https://github.com/tensorflow/privacy', license='Apache-2.0', install_requires=[ diff --git a/tensorflow_privacy/__init__.py b/tensorflow_privacy/__init__.py index 4942ca6..dd1ca07 100644 --- a/tensorflow_privacy/__init__.py +++ b/tensorflow_privacy/__init__.py @@ -1,4 +1,4 @@ -# Copyright 2019, The TensorFlow Privacy Authors. +# Copyright 2020, The TensorFlow Privacy Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -19,6 +19,8 @@ from __future__ import print_function import sys +from tensorflow_privacy.version import __version__ # pylint: disable=g-bad-import-order + # pylint: disable=g-import-not-at-top if hasattr(sys, 'skip_tf_privacy_import'): # Useful for standalone scripts. diff --git a/tensorflow_privacy/version.py b/tensorflow_privacy/version.py new file mode 100644 index 0000000..92721a4 --- /dev/null +++ b/tensorflow_privacy/version.py @@ -0,0 +1,16 @@ +# Copyright 2020, The TensorFlow Privacy Authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +"""TensorFlow Privacy version.""" + +__version__ = '0.4.0'