Skip to content
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

Update rules_python to 0.16.1 #7160

Merged
merged 2 commits into from
Dec 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -211,34 +211,46 @@ http_archive(

http_archive(
name = "rules_python",
sha256 = "5fa3c738d33acca3b97622a13a741129f67ef43f5fdfcec63b29374cc0574c29",
strip_prefix = "rules_python-0.9.0",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.9.0.tar.gz",
sha256 = "497ca47374f48c8b067d786b512ac10a276211810f4a580178ee9b9ad139323a",
strip_prefix = "rules_python-0.16.1",
url = "https://github.com/bazelbuild/rules_python/archive/refs/tags/0.16.1.tar.gz",
)

load("@rules_python//python:repositories.bzl", "python_register_toolchains")

# TODO(mattSoulanille): Change the docker so it doesn't run as root?
# https://github.com/bazelbuild/rules_python/pull/713
# https://github.com/GoogleCloudPlatform/cloud-builders/issues/641
python_register_toolchains(
name = "python3_8",
ignore_root_user_error = True,
# Available versions are listed in @rules_python//python:versions.bzl.
python_version = "3.8",
)

load("@python3_8//:defs.bzl", "interpreter")
load("@rules_python//python:pip.bzl", "pip_install")
load("@rules_python//python:pip.bzl", "pip_parse")

pip_install(
name = "tensorflowjs_dev_deps",
pip_parse(
name = "tensorflowjs_deps",
python_interpreter_target = interpreter,
requirements = "@//tfjs-converter/python:requirements-dev.txt",
requirements_lock = "@//tfjs-converter/python:requirements_lock.txt",
)

pip_install(
name = "tensorflowjs_deps",
load("@tensorflowjs_deps//:requirements.bzl", install_tfjs_deps = "install_deps")

install_tfjs_deps()

pip_parse(
name = "tensorflowjs_dev_deps",
python_interpreter_target = interpreter,
requirements = "@//tfjs-converter/python:requirements.txt",
requirements_lock = "@//tfjs-converter/python:requirements-dev_lock.txt",
)

load("@tensorflowjs_dev_deps//:requirements.bzl", install_tfjs_dev_deps = "install_deps")

install_tfjs_dev_deps()

load("//tfjs-tflite:tflite_repositories.bzl", "tflite_repositories")

tflite_repositories()
Expand Down
20 changes: 19 additions & 1 deletion tfjs-converter/python/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_python//python:packaging.bzl", "py_package", "py_wheel")
load("@rules_python//python:pip.bzl", "compile_pip_requirements")

package(default_visibility = ["//visibility:public"])

Expand All @@ -9,6 +10,23 @@ CONSOLE_SCRIPTS = {
"tensorflowjs_wizard": "tensorflowjs.converters.wizard:pip_main",
}

compile_pip_requirements(
name = "tensorflowjs_deps_requirements",
extra_args = ["--allow-unsafe"], # Allow pinning setuptools
requirements_in = "requirements.txt",
requirements_txt = "requirements_lock.txt",
)

compile_pip_requirements(
name = "tensorflowjs_dev_deps_requirements",
data = [
":requirements.txt",
],
extra_args = ["--allow-unsafe"], # Allow pinning setuptools
requirements_in = "requirements-dev.txt",
requirements_txt = "requirements-dev_lock.txt",
)

py_package(
name = "tensorflowjs_pkg",
# Only include these Python packages.
Expand Down Expand Up @@ -48,7 +66,7 @@ py_wheel(
license = "Apache 2.0",
python_tag = "py3",
requires = [
"flax>=0.5.3",
"flax>=0.6.2",
"importlib_resources>=5.9.0",
"jax>=0.3.16",
"protobuf<3.20,>=3.9.2",
Expand Down
1 change: 1 addition & 0 deletions tfjs-converter/python/requirements-dev.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
-r requirements.txt
PyInquirer==1.0.3
pylint==2.5.0; python_version > '3.0'
setuptools==65.6.3
1,101 changes: 1,101 additions & 0 deletions tfjs-converter/python/requirements-dev_lock.txt

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion tfjs-converter/python/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
flax>=0.5.3
flax>=0.6.2,<0.6.3
jax>=0.3.16
importlib_resources>=5.9.0
protobuf<3.20,>=3.9.2
Expand Down
Loading