From 0946fd1c2b8b3086b2954adee53d7143e3525ca1 Mon Sep 17 00:00:00 2001 From: bzantium Date: Sun, 5 Apr 2026 09:48:20 +0900 Subject: [PATCH] Add uv project metadata --- .gitignore | 2 ++ DEVELOPMENT.md | 11 +++++++++ pyproject.toml | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 73 insertions(+) diff --git a/.gitignore b/.gitignore index 07d8fa2d72e..8d6beb6065c 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ /bazel-* /.idea +.venv/ .DS_Store *.pyc *.egg-info/ *.swp node_modules +uv.lock diff --git a/DEVELOPMENT.md b/DEVELOPMENT.md index b3a902e37e0..942b94b92e5 100644 --- a/DEVELOPMENT.md +++ b/DEVELOPMENT.md @@ -23,6 +23,17 @@ $ source tf/bin/activate (tf)$ pip uninstall -y tb-nightly ``` +If you prefer [uv](https://github.com/astral-sh/uv), you can manage the same +development environment from the repository root with: + +```sh +$ uv sync --extra tensorflow +$ uv run bazel run //tensorboard -- --logdir /path/to/logs +``` + +This gives `uv` enough project metadata to manage dependencies from the repo +root, while still using Bazel for the actual TensorBoard build. + 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. You can build and run TensorBoard via Bazel (from within the TensorFlow nightly virtualenv) as follows: diff --git a/pyproject.toml b/pyproject.toml index 74ff5190487..a220457430b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,63 @@ +[build-system] +requires = ["setuptools>=64", "wheel"] +build-backend = "setuptools.build_meta" + +[project] +name = "tensorboard" +dynamic = ["version", "dependencies"] +description = "TensorBoard lets you watch Tensors Flow" +readme = {file = "tensorboard/pip_package/README.rst", content-type = "text/x-rst"} +requires-python = ">=3.9" +license = {text = "Apache 2.0"} +authors = [{name = "Google Inc.", email = "packages@tensorflow.org"}] +keywords = [ + "tensorflow", + "tensorboard", + "tensor", + "machine learning", + "visualizer", +] +classifiers = [ + "Development Status :: 4 - Beta", + "Intended Audience :: Developers", + "Intended Audience :: Education", + "Intended Audience :: Science/Research", + "License :: OSI Approved :: Apache Software License", + "Programming Language :: Python :: 3", + "Programming Language :: Python :: 3.9", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Programming Language :: Python :: 3 :: Only", + "Topic :: Scientific/Engineering :: Mathematics", + "Topic :: Software Development :: Libraries", + "Topic :: Software Development :: Libraries :: Python Modules", +] + +[project.scripts] +tensorboard = "tensorboard.main:run_main" + +[project.entry-points."tensorboard_plugins"] +projector = "tensorboard.plugins.projector.projector_plugin:ProjectorPlugin" + +[project.optional-dependencies] +tensorflow = ["tf-nightly"] + +[tool.setuptools.dynamic] +version = {attr = "tensorboard.version.VERSION"} +dependencies = {file = ["tensorboard/pip_package/requirements.txt"]} + +[tool.setuptools.packages.find] +include = ["tensorboard", "tensorboard.*"] +exclude = ["tensorboard.pip_package", "tensorboard.pip_package.*"] + +[tool.setuptools.package-data] +tensorboard = ["webfiles.zip"] +"tensorboard.plugins.projector" = [ + "tf_projector_plugin/index.js", + "tf_projector_plugin/projector_binary.html", + "tf_projector_plugin/projector_binary.js", +] + [tool.black] line-length = 80 target-version = ["py36", "py37", "py38"]