You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
docs: add instructions for linting Python code (#3033)
Summary:
As of #2967, backend code is linted with Black.
Test Plan:
One can successfully install and run the listed version of Black:
```
ve="$(mktemp -d)" &&
virtualenv -q -p python3.7 "${ve}" &&
. "${ve}/bin/activate" &&
pip install tf-nightly \
-r tensorboard/pip_package/requirements.txt \
-r tensorboard/pip_package/requirements_dev.txt \
&&
black .
```
This prints, “All done! 347 files left unchanged.”
wchargin-branch: docs-black
Copy file name to clipboardExpand all lines: DEVELOPMENT.md
+8-2Lines changed: 8 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,12 +1,12 @@
1
1
# How to Develop TensorBoard
2
2
3
-
TensorBoard at HEAD relies on the nightly installation of TensorFlow: this allows plugin authors to use the latest features of TensorFlow, but it means release versions of TensorFlow may not suffice for development. We recommend installing TensorFlow nightly in a [Python virtualenv](https://virtualenv.pypa.io), and then running your modified development copy of TensorBoard within that virtualenv. To install TensorFlow nightly within the virtualenv, you can simply run
3
+
TensorBoard at HEAD relies on the nightly installation of TensorFlow: this allows plugin authors to use the latest features of TensorFlow, but it means release versions of TensorFlow may not suffice for development. We recommend installing TensorFlow nightly in a [Python virtualenv](https://virtualenv.pypa.io), and then running your modified development copy of TensorBoard within that virtualenv. To install TensorFlow nightly within the virtualenv, as well as TensorBoard's runtime and tooling dependencies, you can run:
TensorBoard builds are done with [Bazel](https://bazel.build), so you may need to [install Bazel](https://docs.bazel.build/versions/master/install.html). The Bazel build will automatically "vulcanize" all the HTML files and generate a "binary" launcher script. When HTML is vulcanized, it means all the script tags and HTML imports are inlined into one big HTML file. Then the Bazel build puts that index.html file inside a static assets zip. The python HTTP server then reads static assets from that zip while serving.
@@ -23,6 +23,10 @@ You may see warnings about “Limited tf.compat.v2.summary API due to missing Te
23
23
24
24
For any changes to the frontend, you’ll need to install [Yarn][yarn] to lint your code (`yarn lint`, `yarn fix-lint`). You’ll also need Yarn to add or remove any NPM dependencies.
25
25
26
+
For any changes to the backend, you’ll need to install [Black][black] to lint your code (run `black .`). Our `black` version is specified in `requirements_dev.txt` in this repository. Black only runs on Python 3.6 or higher, so you may want to install it into a separate virtual environment and use a [wrapper script to invoke it from any environment][black-wrapper].
27
+
28
+
You may wish to configure your editor to automatically run Prettier and Black on save.
29
+
26
30
To generate fake log data for a plugin, run its demo script. For instance, this command generates fake scalar data in `/tmp/scalars_demo`:
27
31
28
32
```sh
@@ -35,5 +39,7 @@ If you have Bazel≥0.16 and want to build any commit of TensorBoard prior to 20
0 commit comments