Support `list` as well as `typing.List` (among others)
I'm on Python 3.9.9, using betterproto==2.0.0b5.
On the generated code, it uses typing.List, and sometimes does List["FooBar"] if FooBar hasn't already been defined. This does work.
I do, however, use Ruff for linting and fixing common issues, and it turns typing.List["FooBar"] into list["FooBar"], since I'm already on a Python version that supports it.
This, though, causes errors with betterproto: TypeError: 'str' object is not callable
I can tell Ruff to not do this fix, but I think it'd be great if betterproto supported it correctly.
Generating code using typing.List is fine I guess, as it supports more Python versions, but also having support for the new list behavior would be great, as in newer versions, typing.List is deprecated.
I only mentioned list, but I suspect it'll be a similar thing for other types.
Currently you can make this work at runtime if you replace list["Foo"] with "list[Foo]" which is what I do
Currently you can make this work at runtime if you replace list["Foo"] with "list[Foo]" which is what I do
I suspect a from __future__ import annotations would work too, then?
This is another thing I was thinking about suggesting, automatically doing this import, so it can use list[Foo] instead of list["Foo"] or "list[Foo]".
This works now on b7