The BUILD
file supports using Bazel for hermetic building and testing of the model code. In particular a BUILD
file is present in that directory to define the integration test translate_test.py
and its dependencies, so that we can run it on continuous integration system (e.g. Jenkins).
The __init__.py
file causes Python to treat that directory as a package. See this question for a discussion of why __init__.py
is often present in a Python source directory. While this file is not strictly necessary to invoke translate.py
directly from that directory, it is necessary if we want to import the code from translate.py
into a different module.
(Note that when you run a Python binary through Bazel, the build system will automatically generate __init__.py
files if they are missing. However, TensorFlow's repositories often have explicit __init__.py
files in Python source directories so that you can run the code without invoking Bazel.)