Repository navigation
templates: use Python type names in generated docstring - #845
Merged
Merged
Conversation
Added type mappings for various data types in Python.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The generated plugin docstrings, and the API reference built from them, show C++ type names:
other/templates/py/type_conversionsonly maps therepeatedprefix and suffix. Soprotoc-gen-mavsdkfalls back to its built-in C++ defaults (TypeInfo._default_types) forevery primitive.
Change
Map the protobuf primitives to Python types in
other/templates/py/type_conversions(
double/float→float,(u)int32_t/(u)int64_t→int,std::string→str,std::byte→bytes). The bindings were then regenerated withother/tools/run_protoc.sh(pinned
grpcio-tools==1.75.0fromrequirements-dev.txt, Python 3.13).name : typeline(230×
int, 141×str, 75×float). No code changes.mainwith the old mapping reproducesmainexactly, so this diff is onlythe mapping change.
mavsdk-updateworkflow regenerates from these templates, so future releases keep thePython names.
Note:
tracking_serveris staletracking_server.pykeeps two C++ type names because it isn't regenerated any more: itsproto is no longer in
proto/protos, and the plugin is gone from MAVSDK'scpp/src/mavsdk/pluginsat v4.3.0. The generated files were last touched at v2.12.10, but
Systemstill imports andwires it. I left it out of this PR and can send a separate one to remove it, if you'd like.