Skip to content

Commit bfaa4ed

Browse files
authored
BUILD: Setup for release (#62)
* BUILD: Setup versioning
1 parent 1bd2ba6 commit bfaa4ed

File tree

11 files changed

+239
-50
lines changed

11 files changed

+239
-50
lines changed

BUILD

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sh_binary(
55
"LICENSE",
66
"MANIFEST.in",
77
"setup.py",
8-
"tensorflow_addons/__init__.py",
8+
"//tensorflow_addons",
99
"//tensorflow_addons/custom_ops:custom_ops_py",
1010
"//tensorflow_addons/layers:layers_py",
1111
"//tensorflow_addons/losses:losses_py",

CODE_OF_CONDUCT.md

+81-27
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
# TensorFlow Code of Conduct
22

3-
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
3+
In the interest of fostering an open and welcoming environment, we as
4+
contributors and maintainers pledge to making participation in our
5+
project and our community a harassment-free experience for everyone,
6+
regardless of age, body size, disability, ethnicity, gender identity
7+
and expression, level of experience, nationality, personal appearance,
8+
race, religion, or sexual identity and orientation.
49

510

611
## Our Standards
712

8-
Examples of behavior that contributes to creating a positive environment include:
13+
Examples of behavior that contributes to creating a positive environment
14+
include:
915

1016
* Using welcoming and inclusive language.
1117
* Being respectful of differing viewpoints and experiences.
@@ -15,61 +21,109 @@ Examples of behavior that contributes to creating a positive environment include
1521

1622
Examples of unacceptable behavior by participants include:
1723

18-
* The use of sexualized language or imagery and unwelcome sexual attention or
19-
advances.
20-
* Trolling, insulting/derogatory comments, and personal or political attacks.
24+
* The use of sexualized language or imagery and unwelcome sexual
25+
attention or advances.
26+
* Trolling, insulting/derogatory comments, and personal or political
27+
attacks.
2128
* Public or private harassment.
22-
* Publishing others' private information, such as a physical or electronic
29+
* Publishing others' private information, such as a physical or
30+
electronic
2331
address, without explicit permission.
24-
* Conduct which could reasonably be considered inappropriate for the forum in
25-
which it occurs.
32+
* Conduct which could reasonably be considered inappropriate for the
33+
forum in which it occurs.
2634

27-
All TensorFlow forums and spaces are meant for professional interactions, and any behavior which could reasonably be considered inappropriate in a professional setting is unacceptable.
35+
All TensorFlow forums and spaces are meant for professional
36+
interactions, and any behavior which could reasonably be considered
37+
inappropriate in a professional setting is unacceptable.
2838

2939

3040
## Our Responsibilities
3141

32-
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
42+
Project maintainers are responsible for clarifying the standards of
43+
acceptable behavior and are expected to take appropriate and fair
44+
corrective action in response to any instances of unacceptable
45+
behavior.
3346

34-
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
47+
Project maintainers have the right and responsibility to remove, edit,
48+
or reject comments, commits, code, wiki edits, issues, and other
49+
contributions that are not aligned to this Code of Conduct, or to ban
50+
temporarily or permanently any contributor for other behaviors that
51+
they deem inappropriate, threatening, offensive, or harmful.
3552

3653

3754
## Scope
3855

39-
This Code of Conduct applies to all content on tensorflow.org, TensorFlow’s GitHub organization, or any other official TensorFlow web presence allowing for community interactions, as well as at all official TensorFlow events, whether offline or online.
56+
This Code of Conduct applies to all content on tensorflow.org,
57+
TensorFlow’s GitHub organization, or any other official TensorFlow web
58+
presence allowing for community interactions, as well as at all
59+
official TensorFlow events, whether offline or online.
4060

41-
The Code of Conduct also applies within project spaces and in public spaces whenever an individual is representing TensorFlow or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed or de facto representative at an online or offline event.
61+
The Code of Conduct also applies within project spaces and in public
62+
spaces whenever an individual is representing TensorFlow or its
63+
community. Examples of representing a project or community include
64+
using an official project e-mail address, posting via an official
65+
social media account, or acting as an appointed or de facto
66+
representative at an online or offline event.
4267

4368

4469
## Conflict Resolution
4570

46-
Conflicts in an open source project can take many forms, from someone having a bad day and using harsh and hurtful language in the issue queue, to more serious instances such as sexist/racist statements or threats of violence, and everything in between.
71+
Conflicts in an open source project can take many forms,
72+
from someone having a bad day and using harsh and hurtful language in
73+
the issue queue, to more serious instances such as sexist/racist
74+
statements or threats of violence, and everything in between.
4775

48-
If the behavior is threatening or harassing, or for other reasons requires immediate escalation, please see below.
76+
If the behavior is threatening or harassing, or for other reasons
77+
requires immediate escalation, please see below.
4978

50-
However, for the vast majority of issues, we aim to empower individuals to first resolve conflicts themselves, asking for help when needed, and only after that fails to escalate further. This approach gives people more control over the outcome of their dispute.
79+
However, for the vast majority of issues, we aim to empower individuals
80+
to first resolve conflicts themselves, asking for help when needed,
81+
and only after that fails to escalate further. This approach gives
82+
people more control over the outcome of their dispute.
5183

52-
If you are experiencing or witnessing conflict, we ask you to use the following escalation strategy to address the conflict:
84+
If you are experiencing or witnessing conflict, we ask you to use the
85+
following escalation strategy to address the conflict:
5386

54-
1. Address the perceived conflict directly with those involved, preferably in a
55-
real-time medium.
56-
2. If this fails, get a third party (e.g. a mutual friend, and/or someone with
57-
background on the issue, but not involved in the conflict) to intercede.
58-
3. If you are still unable to resolve the conflict, and you believe it rises to
59-
harassment or another code of conduct violation, report it.
87+
1. Address the perceived conflict directly with those involved,
88+
preferably in a real-time medium.
89+
2. If this fails, get a third party (e.g. a mutual friend, and/or
90+
someone with background on the issue, but not involved in theconflict)
91+
to intercede.
92+
3. If you are still unable to resolve the conflict, and you believe it
93+
rises to harassment or another code of conduct violation, report it.
6094

6195
## Reporting Violations
6296

63-
Violations of the Code of Conduct can be reported to TensorFlow’s Project Stewards, Edd Wilder-James ([email protected]) and Sarah Novotny ([email protected]). The Project Steward will determine whether the Code of Conduct was violated, and will issue an appropriate sanction, possibly including a written warning or expulsion from the project, project sponsored spaces, or project forums. We ask that you make a good-faith effort to resolve your conflict via the conflict resolution policy before submitting a report.
97+
Violations of the Code of Conduct can be reported to TensorFlow’s
98+
Project Stewards, Edd Wilder-James ([email protected]) and
99+
Sarah Novotny ([email protected]). The Project Steward will
100+
determine whether the Code of Conduct was violated, and will issue an
101+
appropriate sanction, possibly including a written warning or
102+
expulsion from the project, project sponsored spaces, or project
103+
forums. We ask that you make a good-faith effort to resolve your
104+
conflict via the conflict resolution policy before submitting a
105+
report.
64106

65-
Violations of the Code of Conduct can occur in any setting, even those unrelated to the project. We will only consider complaints about conduct that has occurred within one year of the report.
107+
Violations of the Code of Conduct can occur in any setting, even those
108+
unrelated to the project. We will only consider complaints about
109+
conduct that has occurred within one year of the report.
66110

67111

68112
## Enforcement
69113

70-
If the Project Stewards receive a report alleging a violation of the Code of Conduct, the Project Stewards will notify the accused of the report, and provide them an opportunity to discuss the report before a sanction is issued. The Project Stewards will do their utmost to keep the reporter anonymous. If the act is ongoing (such as someone engaging in harassment), or involves a threat to anyone's safety (e.g. threats of violence), the Project Stewards may issue sanctions without notice.
114+
If the Project Stewards receive a report alleging a violation of the
115+
Code of Conduct, the Project Stewards will notify the accused of the
116+
report, and provide them an opportunity to discuss the report before
117+
a sanction is issued. The Project Stewards will do their utmost to
118+
keep the reporter anonymous. If the act is ongoing (such as someone
119+
engaging in harassment), or involves a threat to anyone's safety (e.g.
120+
threats of violence), the Project Stewards may issue sanctions without
121+
notice.
71122

72123

73124
## Attribution
74125

75-
This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at https://contributor-covenant.org/version/1/4, and includes some aspects of the Geek Feminism Code of Conduct and the Drupal Code of Conduct.
126+
This Code of Conduct is adapted from the Contributor Covenant,
127+
version 1.4, available at https://contributor-covenant.org/version/1/4,
128+
and includes some aspects of the Geek Feminism Code of Conduct and the
129+
Drupal Code of Conduct.

README.md

+8-8
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@ developments that cannot be integrated into core TensorFlow
1212
## Contents
1313
| Sub-Package | Addon | Reference |
1414
|:----------------------- |:----------- |:---------------------------- |
15-
| addons.image | transform | |
16-
| addons.layers | Maxout | https://arxiv.org/abs/1302.4389 |
17-
| addons.layers | PoinareNormalize | https://arxiv.org/abs/1705.08039 |
18-
| addons.layers | WeightNormalization | https://arxiv.org/abs/1602.07868 |
19-
| addons.losses | LiftedStructLoss | https://arxiv.org/abs/1511.06452 |
20-
| addons.losses | TripletSemiHardLoss | https://arxiv.org/abs/1503.03832 |
21-
| addons.optimizers | LazyAdamOptimizer | https://arxiv.org/abs/1412.6980 |
22-
| addons.text | SkipGrams | https://arxiv.org/abs/1301.3781 |
15+
| tfa.image | transform | |
16+
| tfa.layers | Maxout | https://arxiv.org/abs/1302.4389 |
17+
| tfa.layers | PoinareNormalize | https://arxiv.org/abs/1705.08039 |
18+
| tfa.layers | WeightNormalization | https://arxiv.org/abs/1602.07868 |
19+
| tfa.losses | LiftedStructLoss | https://arxiv.org/abs/1511.06452 |
20+
| tfa.losses | TripletSemiHardLoss | https://arxiv.org/abs/1503.03832 |
21+
| tfa.optimizers | LazyAdamOptimizer | https://arxiv.org/abs/1412.6980 |
22+
| tfa.text | skip_gram_sample | https://arxiv.org/abs/1301.3781 |
2323

2424
## Core Concepts
2525

configure.sh

+3-9
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,11 @@ function write_action_env_to_bazelrc() {
2121
write_to_bazelrc "build --action_env $1=\"$2\""
2222
}
2323

24-
rm .bazelrc
25-
26-
# TODO: Verify the tensorflow version here...
27-
if python -c "import tensorflow" &> /dev/null; then
28-
echo 'using installed tensorflow'
29-
else
30-
pip install tf-nightly-2.0-preview
31-
fi
24+
[[ -f .bazelrc ]] && rm .bazelrc
25+
pip install -r requirements.txt
3226

3327
TF_CFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_compile_flags()))') )
3428
TF_LFLAGS=( $(python -c 'import tensorflow as tf; print(" ".join(tf.sysconfig.get_link_flags()))') )
3529

3630
write_action_env_to_bazelrc "TF_HEADER_DIR" ${TF_CFLAGS:2}
37-
write_action_env_to_bazelrc "TF_SHARED_LIBRARY_DIR" ${TF_LFLAGS:2}
31+
write_action_env_to_bazelrc "TF_SHARED_LIBRARY_DIR" ${TF_LFLAGS:2}

requirements.txt

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
tf-nightly-2.0-preview

setup.py

+13-4
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,27 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414
# ==============================================================================
15-
"""Setup for pip package."""
15+
"""Setup for pip package"""
1616
from __future__ import absolute_import
1717
from __future__ import division
1818
from __future__ import print_function
1919

20+
import os
21+
2022
from setuptools import find_packages
2123
from setuptools import setup
2224
from setuptools.dist import Distribution
2325

24-
__version__ = '0.0.1'
26+
version = {}
27+
base_dir = os.path.dirname(os.path.abspath(__file__))
28+
with open(os.path.join(base_dir, "tensorflow_addons", "version.py")) as fp:
29+
exec(fp.read(), version)
30+
31+
2532
REQUIRED_PACKAGES = [
26-
'tf-nightly-2.0-preview',
33+
'six >= 1.10.0',
2734
]
35+
2836
project_name = 'tensorflow-addons'
2937

3038

@@ -37,7 +45,7 @@ def has_ext_modules(self):
3745

3846
setup(
3947
name=project_name,
40-
version=__version__,
48+
version=version['__version__'],
4149
description=('TensorFlow Addons'),
4250
author='Google Inc.',
4351
author_email='[email protected]',
@@ -56,6 +64,7 @@ def has_ext_modules(self):
5664
'Programming Language :: Python :: 3.4',
5765
'Programming Language :: Python :: 3.5',
5866
'Programming Language :: Python :: 3.6',
67+
'Programming Language :: Python :: 3.7',
5968
'Topic :: Scientific/Engineering :: Mathematics',
6069
'Topic :: Software Development :: Libraries :: Python Modules',
6170
'Topic :: Software Development :: Libraries',

tensorflow_addons/BUILD

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
licenses(["notice"]) # Apache 2.0
2+
3+
package(default_visibility = ["//visibility:public"])
4+
5+
py_library(
6+
name = "tensorflow_addons",
7+
data = [
8+
"__init__.py",
9+
"version.py",
10+
],
11+
)

tensorflow_addons/__init__.py

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# Copyright 2019 The TensorFlow Authors. All Rights Reserved.
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+
# http://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+
# ==============================================================================
15+
"""Useful extra functionality for TensorFlow maintained by SIG-addons"""
16+
from __future__ import absolute_import
17+
from __future__ import division
18+
from __future__ import print_function
19+
20+
# We need to put some imports inside a function call below, and the function
21+
# call needs to come before the *actual* imports that populate the
22+
# tensorflow_probability namespace. Hence, we disable this lint check throughout
23+
# the file.
24+
#
25+
# pylint: disable=g-import-not-at-top
26+
27+
28+
# Ensure TensorFlow is importable and its version is sufficiently recent. This
29+
# needs to happen before anything else, since the imports below will try to
30+
# import tensorflow, too.
31+
def _ensure_tf_install(): # pylint: disable=g-statement-before-imports
32+
"""Attempt to import tensorflow, and ensure its version is sufficient.
33+
34+
Raises:
35+
ImportError: if either tensorflow is not importable or its version is
36+
inadequate.
37+
"""
38+
try:
39+
import tensorflow as tf
40+
except ImportError:
41+
# Print more informative error message, then reraise.
42+
print("\n\nFailed to import TensorFlow. Please note that TensorFlow is"
43+
" not installed by default when you install TensorFlow Addons."
44+
" This is so that users can decide whether to install the"
45+
" GPU-enabled TensorFlow package. To use TensorFlow Addons,"
46+
" please install the most recent version of TensorFlow, by"
47+
" following instructions at https://tensorflow.org/install.\n\n")
48+
raise
49+
50+
import distutils.version
51+
52+
#
53+
# Update this whenever we need to depend on a newer TensorFlow release.
54+
#
55+
required_tensorflow_version = "2"
56+
57+
if (distutils.version.LooseVersion(tf.__version__) <
58+
distutils.version.LooseVersion(required_tensorflow_version)):
59+
raise ImportError(
60+
"This version of TensorFlow Addons requires TensorFlow "
61+
"version >= {required}; Detected an installation of version "
62+
"{present}. Please upgrade TensorFlow to proceed.".format(
63+
required=required_tensorflow_version,
64+
present=tf.__version__))
65+
66+
67+
_ensure_tf_install()
68+
69+
# Cleanup symbols to avoid polluting namespace.
70+
del _ensure_tf_install
71+
del absolute_import
72+
del division
73+
del print_function
74+
75+
# Local project imports
76+
from tensorflow_addons import layers
77+
from tensorflow_addons import losses
78+
from tensorflow_addons import optimizers
79+
from tensorflow_addons.custom_ops import image
80+
from tensorflow_addons.custom_ops import text
81+
82+
from tensorflow_addons.version import __version__
83+
# pylint: enable=g-import-not-at-top

tensorflow_addons/losses/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@
1818
from __future__ import division
1919
from __future__ import print_function
2020

21+
from tensorflow_addons.losses.python.lifted import lifted_struct_loss
2122
from tensorflow_addons.losses.python.triplet import triplet_semihard_loss

tensorflow_addons/optimizers/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@
1818
from __future__ import division
1919
from __future__ import print_function
2020

21-
from tensorflow_addons.optimizers.python import lazy_adam_optimizer
21+
from tensorflow_addons.optimizers.python.lazy_adam_optimizer import LazyAdamOptimizer

0 commit comments

Comments
 (0)