When using the protoc --twirpy_out command to generate Python Twirp API code, the plugin generates an empty file for every .proto file dependency that has no services defined. This behavior can be inconvenient and confusing, especially in large projects where many proto files are present.
Proposed Solution
To address this issue, this PR proposes modifying the plugin to only run the twirpy generator if the .proto file contains services. If a file does not define any services, the plugin will skip generating any code for that file.
Problem
When using the
protoc --twirpy_out
command to generate Python Twirp API code, the plugin generates an empty file for every .proto file dependency that has no services defined. This behavior can be inconvenient and confusing, especially in large projects where many proto files are present.Proposed Solution
To address this issue, this PR proposes modifying the plugin to only run the twirpy generator if the .proto file contains services. If a file does not define any services, the plugin will skip generating any code for that file.