verloop / twirpy

Twirp's python implementation
The Unlicense
99 stars 20 forks source link

Only generate when there are services #49

Open rami-lv opened 1 year ago

rami-lv commented 1 year ago

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.