提交 1fdae868 编辑于 作者: Michael Reneer's avatar Michael Reneer 提交者: tensorflow-copybara
浏览文件

Add `version` module to TFF.

Fixes #740

PiperOrigin-RevId: 263364441
上级 c2c469dc
......@@ -4,22 +4,11 @@ licenses(["notice"]) # Apache 2.0
exports_files(["LICENSE"])
config_setting(
name = "py2_mode",
flag_values = {"@bazel_tools//tools/python:python_version": "PY2"},
visibility = [":__subpackages__"],
)
config_setting(
name = "py3_mode",
flag_values = {"@bazel_tools//tools/python:python_version": "PY3"},
visibility = [":__subpackages__"],
)
py_library(
name = "tensorflow_federated",
srcs = ["__init__.py"],
deps = [
":version",
"//tensorflow_federated/python/core/api:computation_base",
"//tensorflow_federated/python/core/api:computation_types",
"//tensorflow_federated/python/core/api:computations",
......@@ -35,3 +24,20 @@ py_library(
"//tensorflow_federated/python/simulation",
],
)
config_setting(
name = "py2_mode",
flag_values = {"@bazel_tools//tools/python:python_version": "PY2"},
visibility = [":__subpackages__"],
)
config_setting(
name = "py3_mode",
flag_values = {"@bazel_tools//tools/python:python_version": "PY3"},
visibility = [":__subpackages__"],
)
py_library(
name = "version",
srcs = ["version.py"],
)
......@@ -18,6 +18,8 @@ from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from tensorflow_federated.version import __version__ # pylint: disable=g-bad-import-order
from tensorflow_federated.python.core.api.computation_base import Computation
from tensorflow_federated.python.core.api.computation_types import FederatedType
from tensorflow_federated.python.core.api.computation_types import FunctionType
......
......@@ -51,13 +51,10 @@ tutorials and try it out yourself!
# TODO(b/124800187): Keep in sync with the contents of README.
import sys
import setuptools
DOCLINES = __doc__.split('\n')
_VERSION = '0.7.0'
project_name = 'tensorflow_federated'
if '--project_name' in sys.argv:
......@@ -66,6 +63,11 @@ if '--project_name' in sys.argv:
sys.argv.remove('--project_name')
sys.argv.pop(project_name_idx)
with open('tensorflow_federated/version.py') as fp:
globals_dict = {}
exec(fp.read(), globals_dict) # pylint: disable=exec-used
VERSION = globals_dict['__version__']
REQUIRED_PACKAGES = [
'attrs~=18.2',
'cachetools~=3.1.1',
......@@ -80,7 +82,7 @@ REQUIRED_PACKAGES = [
setuptools.setup(
name=project_name,
version=_VERSION.replace('-', ''),
version=VERSION,
packages=setuptools.find_packages(exclude=('tools')),
description=DOCLINES[0],
long_description='\n'.join(DOCLINES[2:]),
......
# Lint as: python3
# Copyright 2019, The TensorFlow Federated 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 Federated version."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
__version__ = '0.7.0'
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册