Action Required: Changing downstream workspace dependency protocol for TF

Skip to first unread message

Amit Patankar

Jan 15, 2021, 12:01:49 PM1/15/21
to SIG Build, TensorFlow Developers

Hello Everyone,

Our WORKSPACE file has traditionally exposed non-trivial details of TensorFlow's external dependencies. As a result, downstream projects (projects depending on TensorFlow) broke when we made changes to TensorFlow's WORKSPACE file. In an attempt to address this problem, we restructured our WORKSPACE file to hide the details of TensorFlow's external dependencies.

Going forward, downstream projects should depend on TensorFlow by including the following block in their WORKSPACE file:

  name = "org_tensorflow"
load("@org_tensorflow//tensorflow:workspace3.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace2.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace1.bzl", "workspace")
load("@org_tensorflow//tensorflow:workspace0.bzl", "workspace")

Background: bazel requires load() statements to be at the top of the file. The only exception is the WORKSPACE file. Using multiple workspace files and macros, we can fetch an external repository in workspace<N+1>.bzl and then load() a macro provided by that repository at the top of workspace<N>.bzl. As long as our repository dependency graph does not grow deeper than 4, downstream projects do not have to adjust their WORKSPACE file when we add new dependencies to TensorFlow.

We would like downstream projects to switch to the new setup by February 5th. This will allow TensorFlow to commit pending changes to its dependencies without breaking downstream projects. Soon after, we will also remove the old workspace.bzl file. An example change can be found here for the downstream serving repo.


Amit Patankar

TensorFlow DevInfra

Reply all
Reply to author
0 new messages