Skip to content

Gazelle plugin should have a configurable naming convention for py_proto_library targets #3081

@shaldengeki

Description

@shaldengeki

🚀 feature request

Relevant Rules

gazelle

Description

The Gazelle plugin (once it lands in #3057) by default names py_proto_library targets it generates using a suffix of py_proto. There is currently no way to configure this, like there is in other generated rules, and there should be, if only for consistency's sake.

Describe the solution you'd like

Add a new directive named python_proto_naming_convention. This convention should be an interpolation rule, much like python_library_naming_convention.

However, since we generate a py_proto_library per proto, we don't want to interpolate $package_name$. I propose that we should instead interpolate $proto_name$, where $proto_name$ gets the proto_library name, minus the _proto suffix. The default value of python_library_naming_convention should be $proto_name$_py_proto.

So by default, Gazelle's proto extension would generate foo_proto for a foo.proto, and our extension would then generate foo_py_proto, aligning with what the naming that the Java & Golang extensions use.

Describe alternatives you've considered

We could choose not to do this? But I think this will be useful for some folks who have preexisting naming schemes in their repos and want to use the plugin. This will ease the migration process for those users.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions