Skip to content

Commit 55739b0

Browse files
Loosen protocolbuffers/python protobuf runtime dependency (#2053)
We currently set a minimum version of the runtime `protobuf` package for protocolbuffers/python based on the documented ["new gencode + old runtime = never allowed"][1] rule that generally applies to the protocolbuffers plugins - that the runtime versions are free to add runtime APIs in any release and it's expected that the gencode must be updated to run with the new runtime version. However, [Python has a separate carve-out behavior for its gencode][2], documented now as: > Since the 3.20.0 release, the Protobuf Python generated code became a > thin wrapper around an embedded FileDescriptorProto. Because these > protos are supported on extremely long timeframes, our usual major > version compatibility windows aren’t typically necessary. > Python may break generated code compatibility in specific future major > version releases, but it will be coupled with poison pill warnings and > errors in advance. As of 6.32.0, all generated code since 3.20.0 will be > supported until at least 8.x.y. This means that we don't need to pin the protocolbuffers/python version to the matching runtime version; we can loosen the minimum to `3.20.0` (and will need to reevaluate this in the future v8 major release). This commit pins the latest minor release in each major version to a minimum of 3.20. An alternative is to _just_ specify `protobuf` without any version specifiers, and allow consumers to pick the version of `protobuf` they want to supply. But since the minimum is pretty clearly documented, I think supplying it is reasonable. [1]: https://protobuf.dev/support/cross-version-runtime-guarantee/#backwards [2]: https://protobuf.dev/support/cross-version-runtime-guarantee/#python --- * The [first commit](8e4141a) applies the above on the latest minor release of each major version of protocolbuffers/python (and protocolbuffers/pyi, which protocolbuffers/python depends on). * The [second commit](289a3e8) does the rest of the versions. We can revert this commit if we'd like, but I think it would be better to update all of these in one shot to avoid confusion. * The [third commit](72a8bc5) is optional, but in the same vein: we currently set a fairly strict lower bound on the `types-protobuf` dependency of protocolbuffers/pyi, but we don't have any real guarantees about how those versions map to the runtime version. I think we ought to loosen them to just allow the user to figure out the version they want. Again, we can revert this, but I figure we ought to do this update in one-shot.
1 parent 6d54a55 commit 55739b0

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

plugins/protocolbuffers/pyi/v30.2/buf.plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ registry:
1414
requires_python: ">=3.9"
1515
deps:
1616
# https://pypi.org/project/protobuf/
17-
- "protobuf~=6.30.2"
18-
- "types-protobuf~=5.29"
17+
- "protobuf>=3.20"
18+
- "types-protobuf"

plugins/protocolbuffers/pyi/v31.1/buf.plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@ registry:
1414
requires_python: ">=3.9"
1515
deps:
1616
# https://pypi.org/project/protobuf/
17-
- "protobuf~=6.31.1"
18-
- "types-protobuf~=6.30"
17+
- "protobuf>=3.20"
18+
- "types-protobuf"

plugins/protocolbuffers/pyi/v32.1/buf.plugin.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ registry:
1414
requires_python: ">=3.9"
1515
deps:
1616
# https://pypi.org/project/protobuf/
17-
- "protobuf>=6.32.1"
17+
- "protobuf>=3.20"
1818
# https://pypi.org/project/types-protobuf/
19-
- "types-protobuf>=6.32"
19+
- "types-protobuf"

plugins/protocolbuffers/python/v30.2/buf.plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ registry:
1616
requires_python: ">=3.9"
1717
deps:
1818
# https://pypi.org/project/protobuf/
19-
- "protobuf~=6.30.2"
19+
- "protobuf>=3.20"

plugins/protocolbuffers/python/v31.1/buf.plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ registry:
1616
requires_python: ">=3.9"
1717
deps:
1818
# https://pypi.org/project/protobuf/
19-
- "protobuf~=6.31.1"
19+
- "protobuf>=3.20"

plugins/protocolbuffers/python/v32.1/buf.plugin.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ registry:
1616
requires_python: ">=3.9"
1717
deps:
1818
# https://pypi.org/project/protobuf/
19-
- "protobuf>=6.32.1"
19+
- "protobuf>=3.20"

0 commit comments

Comments
 (0)