Skip to content

Commit 8650926

Browse files
csferngtensorflow-copybara
authored andcommitted
Adds version.py and nsl.__version__
This change creates `version.py` to hold the version information, which is shared to `nsl.__version__` and `setup.py`. Fixes #25 PiperOrigin-RevId: 273395360
1 parent aad3635 commit 8650926

File tree

3 files changed

+35
-1
lines changed

3 files changed

+35
-1
lines changed

neural_structured_learning/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from neural_structured_learning import keras
55
from neural_structured_learning import lib
66
from neural_structured_learning import tools
7+
from neural_structured_learning.version import __version__
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Copyright 2019 Google LLC
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# https://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
"""Defines neural_structured_learning version information."""
15+
16+
# We follow Semantic Versioning (https://semver.org/).
17+
_MAJOR_VERSION = '1'
18+
_MINOR_VERSION = '0'
19+
_PATCH_VERSION = '1'
20+
21+
_VERSION_SUFFIX = ''
22+
23+
__version__ = '.'.join([_MAJOR_VERSION, _MINOR_VERSION, _PATCH_VERSION])
24+
if _VERSION_SUFFIX:
25+
__version__ = '{}-{}'.format(__version__, _VERSION_SUFFIX)

setup.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# limitations under the License.
1414
"""Setup file for the TensorFlow Neural Structured Learning pip package."""
1515

16+
import os
17+
import sys
1618
import textwrap
1719

1820
import setuptools
@@ -59,9 +61,15 @@
5961
Incorporating structured signals is done only during training, so the
6062
performance of the serving/inference workflow remains unchanged.""")
6163

64+
# Adds the path to sys.path so that we can import version.py.
65+
version_path = os.path.join(os.path.dirname(__file__),
66+
"neural_structured_learning")
67+
sys.path.append(version_path)
68+
from version import __version__ # pylint: disable=g-import-not-at-top
69+
6270
setuptools.setup(
6371
name="neural-structured-learning",
64-
version="1.0.1",
72+
version=__version__,
6573
author="Google LLC",
6674
description="Neural Structured Learning is an open-source TensorFlow "
6775
"framework to train neural networks with structured signals",

0 commit comments

Comments
 (0)