-
Notifications
You must be signed in to change notification settings - Fork 163
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do not load WIT TB plugin in TB versions earlier than 2.2 #64
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM: a couple comments inline, but all optional.
version_list = tensorboard.__version__.split(".") | ||
if (int(version_list[0]) < 2 or | ||
(int(version_list[0]) == 2 and int(version_list[1]) < 2)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional, but consider using pkg_resources.parse_version
here:
import pkg_resources
_MIN_TENSORBOARD_VERSION = pkg_resources.parse_version("2.2.0")
version = pkg_resources.parse_version(tensorboard.__version__)
if version < _MIN_TENSORBOARD_VERSION:
return None
This way, you don’t have to do the parsing yourself, and you don’t have
to worry about edge cases (like, 2.9a0
is a valid version number, even
if we’re not super likely to use it).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah great didn't know about that build-in lib. tried out packaging but that required a new dep and i didn't want to add one.
used this code and retested.
|
||
# If TB version is before 2.2.0, then do not load the WIT plugin | ||
# as it is already included directly in TensorBoard. | ||
version_list = tensorboard.__version__.split(".") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: tensorboard.__version__
was added in TensorBoard 1.14.0. If
you want to be back-compatible with older versions, you can use:
import tensorboard.version
tb_version = tensorboard.version.VERSION
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't think we'll need backwards compat with 1.14, as colab falls back to 1.15 with the tensorflow 1.x magic and anyone installing 1.14 from scratch won't get this pip package
I’ve tested this in Colab with:
and verified that the result launches with a working What-If Tool both |
thanks @wchargin , made your pkg_resources change and retested to verify. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me as well.
Do we need to add pkg_resources as a dependency to pip? A quick search suggests it's part of python setuptools.
Good quesion. Since this is a TB package that runs as part of TB, and TB has a dep on setuptools, is that situation appropriate for this package? Or should we explicitly also have a requirement on setuptools? @wchargin your opinion? |
Hi, sorry, just saw this. It might be a little nicer to have an explicit |
See tensorflow/tensorboard#3460 for root cause.
This PR ensures that the tensorboard-plugin-wit package will only load the plugin in TensorBoards 2.2 or later, when WIT was removed as a built-in plugin.