Skip to content

Commit 117d727

Browse files
authored
Upgrade pxapi pypi python dependencies. Replace rules_go's gogo with third_party dir version (#2181)
Summary: Upgrade pxapi pypi python dependencies. Replace rules_go gogo with `third_party` dir version This change is best viewed commit by commit as described below. Commit 1: Replace `rules_go`'s version of gogo with third_party directory copy Commit 2: Update proto and BUILD files to use new bazel repo name Commit 3: Regnerate go and ts/js protos. TS/JS ones are expected to not change Commit 4: Replace python pxapi's python-gogo with the bazel version. The existing gogo bazel repository needed to be changed because Python does not support periods in module names. `rules_go` and our internal gogo repository (`gogo_grpc_proto`) used a directory structure and a protobuf compiler patch that resulting in non functional python code (a module named `github.com` is created). This change renames the internal gogo repository to prevent its filepath from containing periods. The pr-third-party-deps action is complaining about protobuf. I believe this is a false positive as it uses the BSD-3-Clause license. Relevant Issues: #2140 Type of change: /kind cleanup Test Plan: Existing unit tests and the following: - [x] Ran `src/api/python/examples` with python 3.9 and 3.13 <details><summary>Python 3.9 and 3.13 test</summary> ``` # Build the wheel $ bazel build src/api/python:pxapi [ ... ] Target //src/api/python:pxapi up-to-date: bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl # Run the example with python 3.13 $ docker run --entrypoint bash -it -v $(pwd):/src -w /src python:3.13 $ pip install bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl root@d5a1f69d4e87:/src# PX_API_KEY=<api key> python src/api/python/examples/list_clusters.py eb94bd7e-0a8a-45c0-b22e-81d62bd99755 # Run the example with python 3.9 $ docker run --entrypoint bash -it -v $(pwd):/src -w /src python:3.9 $ pip install bazel-bin/src/api/python/pxapi-0.8.1-py3-none-any.whl root@08ed22fe680e:/src# PX_API_KEY=<api key> python src/api/python/examples/list_clusters.py eb94bd7e-0a8a-45c0-b22e-81d62bd99755 ``` </details> Changelog Message: Upgrade the pxapi python module's third party dependencies and support Python 3.11 through 3.13 --------- Signed-off-by: Dom Del Nano <ddelnano@gmail.com>
1 parent 2711c9f commit 117d727

File tree

121 files changed

+3336
-3334
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

121 files changed

+3336
-3334
lines changed

.arclint

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
"(^src/ui/src/types/generated/)",
3434
"(^src/ui/src/types/schema\\.ts$)",
3535
"(^third_party/cpplint/cpplint.py$)",
36-
"(^third_party/github.com/gogo/protobuf/gogoproto/gogo.proto$)",
36+
"(^third_party/gogoproto/gogo.proto$)",
3737
"(c_cpp_properties.json$)",
3838
"(go\\.mod$)",
3939
"(go\\.sum$)"

bazel/external/protobuf_javascript.patch

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ index 97b5844..1351a54 100644
66

77
for (int i = 0; i < file->dependency_count(); i++) {
88
const std::string& name = file->dependency(i)->name();
9-
+ if (ModuleAlias(name) == "github_com_gogo_protobuf_gogoproto_gogo_pb") {
9+
+ if (ModuleAlias(name) == "gogoproto_gogo_pb") {
1010
+ continue;
1111
+ }
1212
printer->Print(

bazel/gogo.bzl

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def _gogo_grpc_proto_impl(ctx):
2323
ctx.file("WORKSPACE", 'workspace(name = "{}")'.format(ctx.name))
2424
ctx.file("BUILD.bazel", "")
2525
ctx.symlink(
26-
ctx.path(Label("@com_github_gogo_protobuf//gogoproto:gogo.proto")),
27-
"github.com/gogo/protobuf/gogoproto/gogo.proto",
26+
ctx.path(Label("//third_party/gogoproto:gogo.proto")),
27+
"gogoproto/gogo.proto",
2828
)
29-
ctx.file("github.com/gogo/protobuf/gogoproto/BUILD.bazel", """
29+
ctx.file("gogoproto/BUILD.bazel", """
3030
31-
load("@px//bazel:proto_compile.bzl", "pl_proto_library", "pl_cc_proto_library")
31+
load("@px//bazel:proto_compile.bzl", "pl_proto_library", "pl_cc_proto_library", "pl_py_proto_library")
3232
3333
pl_proto_library(
3434
name = "gogo_pl_proto",
@@ -44,6 +44,13 @@ pl_cc_proto_library(
4444
deps = [],
4545
)
4646
47+
pl_py_proto_library(
48+
name = "gogo_pl_py_proto",
49+
proto = ":gogo_pl_proto",
50+
visibility = ["//visibility:public"],
51+
deps = [],
52+
)
53+
4754
""")
4855

4956
gogo_grpc_proto = repository_rule(

bazel/repositories.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def _cc_deps():
121121
# Dependencies with native bazel build files.
122122

123123
_bazel_repo("upb")
124-
_bazel_repo("com_google_protobuf", patches = ["//bazel/external:protobuf_gogo_hack.patch", "//bazel/external:protobuf_text_format.patch", "//bazel/external:protobuf_warning.patch"], patch_args = ["-p1"])
124+
_bazel_repo("com_google_protobuf", patches = ["//bazel/external:protobuf_text_format.patch", "//bazel/external:protobuf_warning.patch"], patch_args = ["-p1"])
125125
_bazel_repo("com_github_grpc_grpc", patches = ["//bazel/external:grpc.patch", "//bazel/external:grpc_go_toolchain.patch", "//bazel/external:grpc_test_visibility.patch"], patch_args = ["-p1"])
126126

127127
_bazel_repo("boringssl", patches = ["//bazel/external:boringssl.patch"], patch_args = ["-p0"])

scripts/update_ts_protos.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function copy() {
4848
# VizierapiServiceClient.ts has a relative import; we're copying elsewhere. We fix this with perl string substitution.
4949
regexRelativeImport="s|import \* as ([^ ]+) from '([^ /]+/)+vizierapi_pb'\;|import * as \1 from './vizierapi_pb';|m"
5050
# vizierapi_pb.d.ts incorrectly includes an unused (and non-existent) relative import related to Go protos. Remove it.
51-
regexExtraneousImport="s|^import \* as github_com_gogo_protobuf_gogoproto_gogo_pb.*$||m"
51+
regexExtraneousImport="s|^import \* as gogoproto_gogo_pb.*$||m"
5252

5353
for abs_path in $abs_paths; do
5454
echo "Propagating ${abs_path} ..."

src/api/proto/cloudpb/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ pl_proto_library(
2626
"//src/api/proto/uuidpb:uuid_pl_proto",
2727
"//src/api/proto/vispb:vis_pl_proto",
2828
"//src/api/proto/vizierconfigpb:vizier_pl_proto",
29-
"@gogo_special_proto//github.com/gogo/protobuf/gogoproto",
29+
"@gogo_grpc_proto//gogoproto:gogo_pl_proto",
3030
],
3131
)
3232

src/api/proto/cloudpb/cloudapi.pb.go

Lines changed: 356 additions & 356 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/api/proto/cloudpb/cloudapi.proto

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ option go_package = "cloudpb";
2828
// * Please do not include dependencies that are outside of src/api
2929
// * and only include protobufs that are useful to external-facing users.
3030
//
31-
import "github.com/gogo/protobuf/gogoproto/gogo.proto";
31+
import "gogoproto/gogo.proto";
3232
import "google/protobuf/empty.proto";
3333
import "google/protobuf/timestamp.proto";
3434
import "google/protobuf/wrappers.proto";

src/api/proto/vispb/BUILD.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ pl_proto_library(
2121
srcs = ["vis.proto"],
2222
visibility = ["//src:__subpackages__"],
2323
deps = [
24-
"@gogo_special_proto//github.com/gogo/protobuf/gogoproto",
24+
"@gogo_grpc_proto//gogoproto:gogo_pl_proto",
2525
],
2626
)
2727

src/api/proto/vispb/vis.pb.go

Lines changed: 123 additions & 124 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)