Skip to content

Bump protobuf to v24.4 and update generator script - #11693

Merged
JelleZijlstra merged 4 commits into
python:mainfrom
Avasam:update-protobuff
Apr 7, 2024
Merged

JelleZijlstra merged 4 commits into
python:mainfrom
Avasam:update-protobuff

Conversation

@Avasam

@Avasam Avasam commented Apr 1, 2024

Copy link
Copy Markdown
Collaborator

Closes #11686 and closes #11685

As of v22, protobuf downloads on github no longer provides a zip per language, but rather a single zip with all languages. I've updated the script to work on v22+ and bumped protobuf to v24 to reflect what the stubs claim to cover.

I could easily have the version in METADATA.toml follow the python protobuf version used by the script. LMK if you also think that would be a good idea (with an appropriate comment in METADATA.toml)

I didn't bump all the way up to v26 (#10964) because I wanted to at least correct the existing v24 typings

CC @AlexWaygood I also fixed the pre-commit run --files invocation so it's actually passed the files to check, runs without error, and re-run Ruff as a second pass because unused imports are not removed when fixing UP036 Version block is outdated for minimum Python version

CC @ijknabla FYI

@github-actions

This comment has been minimized.

Comment thread scripts/sync_tensorflow_protobuf_stubs.sh Outdated
@github-actions

github-actions Bot commented Apr 1, 2024

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉


sed --in-place="" \
"s/extra_description = .*$/extra_description = \"Generated using [mypy-protobuf==$MYPY_PROTOBUF_VERSION](https:\/\/github.com\/nipunn1313\/mypy-protobuf\/tree\/v$MYPY_PROTOBUF_VERSION) on protobuf==$PYTHON_PROTOBUF_VERSION\"/" \
"s/extra_description = .*$/extra_description = \"Generated using [mypy-protobuf==$MYPY_PROTOBUF_VERSION](https:\/\/github.com\/nipunn1313\/mypy-protobuf\/tree\/v$MYPY_PROTOBUF_VERSION) on [protobuf v$PROTOBUF_VERSION](https:\/\/github.com\/protocolbuffers\/protobuf\/releases\/tag\/v$PROTOBUF_VERSION) (python protobuf==$PYTHON_PROTOBUF_VERSION)\"/" \

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very long line, but idk how to do a single argument multiline string in bash

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you can split a line by placing ”¥¥¥n” immediately after the word you want to separate.

"s/extra_description = .*$/extra_description = "\
"\"Generated using [mypy-protobuf==$MYPY_PROTOBUF_VERSION](https:\/\/github.com\/nipunn1313\/mypy-protobuf\/tree\/v$MYPY_PROTOBUF_VERSION)"\
" on [protobuf v$PROTOBUF_VERSION](https:\/\/github.com\/protocolbuffers\/protobuf\/releases\/tag\/v$PROTOBUF_VERSION)"\
" (python protobuf==$PYTHON_PROTOBUF_VERSION)\"/"

also declared with same name and request/response types in
`Storage`. A documentation generator or annotation processor will
see the effective `Storage.GetAcl` method after inheriting
see the effective `Storage.GetAcl` method after inherting

@AlexWaygood AlexWaygood Apr 1, 2024

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lol, did they deliberately introduce a typo or did we accidentally update this in our vendored copy without contributing the typo fix upstream, I wonder?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They deliberately re-introduced it! protocolbuffers/protobuf@b81c127

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Amazing! If this didn't have a citation I'd be certain this was an April Fool's :D

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got to have copyright on those typo fixes

@AlexWaygood

Copy link
Copy Markdown
Member

CC @AlexWaygood I also fixed the pre-commit run --files invocation so it's actually passed the files to check, runs without error, and re-run Ruff as a second pass because unused imports are not removed when fixing UP036 Version block is outdated for minimum Python version

Thanks, those changes look great :)

@Avasam Avasam changed the title Bump protobuf to v24 and update generator script Bump protobuf to v24.4 and update generator script Apr 1, 2024
This was referenced Apr 1, 2024
fully qualified.
"""
@property
def source_file_descriptors(self) -> google.protobuf.internal.containers.RepeatedCompositeFieldContainer[google.protobuf.descriptor_pb2.FileDescriptorProto]:

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This code could solve the problem I pointed out in #11685 . (We can close #11685 .)

@JelleZijlstra
JelleZijlstra merged commit 2135c8c into python:main Apr 7, 2024
@Avasam
Avasam deleted the update-protobuff branch April 7, 2024 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Type-stub for CodeGeneratorRequest in google.protobuf

4 participants