python-betterproto icon indicating copy to clipboard operation
python-betterproto copied to clipboard

warnings package not imported for deprecated warning.

Open jbkoh opened this issue 4 years ago • 1 comments

Hi there, thanks for the great project!

My environment: betterproto: v2.0.0b3 python: v3.8.5 OS: Ubuntu 20.04

I use deprecated option in a message definition. betterproto generates a warnings.warn properly, but the warnings package is not imported, so it throws NameError: name 'warnings' is not defined. I manually add the line for now, but it'd be great if it can be fixed in the package.

Thanks!

jbkoh avatar May 14 '21 04:05 jbkoh

To reprodue

syntax = "proto3";
message Foo {
  option deprecated = true;
  string old_field = 1;
}

seems like https://github.com/danielgtaylor/python-betterproto/blob/496eba27506a2fe18df409c4cd34a47d8ce04ffe/src/betterproto/plugin/models.py#L280 needs a case for if message.deprecated

Gobot1234 avatar Aug 02 '22 08:08 Gobot1234