Skip to content

Releases: danielgtaylor/python-betterproto

v2.0.0-beta7

14 Aug 21:25
1538e15
Compare
Choose a tag to compare
v2.0.0-beta7 Pre-release
Pre-release

Enhancements

  • Breaking: Support Pydantic v2 and dropping support for v1 #588
  • Breaking: The attempting to access an unset oneof now raises an AttributeError field. To see how to access oneof fields now, refer to #558 and README.md.
  • Breaking: A custom Enum has been implemented to match the behaviour of being an open set. Any checks for isinstance(enum_member, enum.Enum) and issubclass(EnumSubclass, enum.Enum) will now return False. This change also has the side effect of preventing any passthrough of Enum members (i.e. Foo.RED.GREEN doesn't work any more). See #293 for more info, this fixed many bugs related to Enum handling.
  • Add support for pickle methods #535
  • Add support for Struct and Value types #551
  • Add support for Rich package for pretty printing #508
  • Improve support for streaming messages #518 #529
  • Improve performance of serializing / de-serializing messages #545
  • Improve the handling of message name collisions with typing by allowing the method / type of imports to be configured.
    Refer to #582 and README.md.
  • Add a warning when calling a deprecated message #596

Bug Fixes

  • Fix roundtrip parsing of datetimes #534
  • Fix accessing unset optional fields #523
  • Fix Message equality comparison #513
  • Fix behaviour with long comment messages #532

New Contributors

Full Changelog: v.2.0.0b6...v.2.0.0b7

v2.0.0-beta6

25 Jun 23:27
098989e
Compare
Choose a tag to compare
v2.0.0-beta6 Pre-release
Pre-release

Enhancements

  • Breaking: the minimum Python version has been bumped to 3.7 #444

  • Support generating Pydantic dataclasses. Pydantic dataclasses are are drop-in replacement for dataclasses in the standard library that additionally supports validation.
    Pass --python_betterproto_opt=pydantic_dataclasses to enable this feature. Refer to #406 and README.md for more information.

  • Added support for @generated marker #382

  • Pull down the include_default_values argument to to_json() #405

  • Pythonize input_type name in py_input_message #436

  • Widen from_dict() to accept any Mapping #451

  • Replace pkg_resources with importlib #462

Bug Fixes

  • Fix typechecker compatibility checks in server streaming methods #413
  • Fix "empty-valued" repeated fields not being serialised #417
  • Fix dict encoding for timezone-aware datetimes #468
  • Fix to_pydict() serialization for optional fields #495
  • Handle empty value objects properly #481

Thank you to all the contributors to this release and everyone for being so patient with its release.

New Contributors

Full Changelog: v2.0.0b5...v.2.0.0b6

v2.0.0-beta5

01 Aug 23:28
496eba2
Compare
Choose a tag to compare
v2.0.0-beta5 Pre-release
Pre-release

Enhancements

  • Breaking: Client and Service Stubs no longer pack and unpack the input message fields as parameters #331:

    Update your client calls and server handlers as follows:

    Clients before:

    response = await service.echo(value="hello", extra_times=1)

    Clients after:

    response = await service.echo(EchoRequest(value="hello", extra_times=1))

    Servers before:

    async def echo(self, value: str, extra_times: int) -> EchoResponse: ...

    Servers after:

    async def echo(self, echo_request: EchoRequest) -> EchoResponse:
        # Use echo_request.value
        # Use echo_request.extra_times
        ...
  • Format field comments also as docstrings #304

  • Implement __deepcopy__ for Message #339

  • Implement to/from_pydict() for Message #203

  • Run isort on compiled code #355

  • Expose timeout, deadline and metadata parameters from grpclib #352

  • Make Message.__getattribute__ invisible to type checkers #359

Bug Fixes

  • Fix map field edge-case #254
  • Fix message text in NotImplementedError #325
  • Fix Message.from_dict() in the presence of optional datetime fields #329
  • Support Jinja2 3.0 #330 & #402
  • Fix overwriting top level __init__.py #337
  • Remove deprecation warnings when fields are initialised with non-default values #348
  • Ensure nested class names are converted to PascalCase #353
  • Fix Message.to_dict() mutating the underlying Message #378
  • Fix some parameters being missing from services #381

v2.0.0-beta4

03 Jan 18:34
6dd7baa
Compare
Choose a tag to compare
v2.0.0-beta4 Pre-release
Pre-release

Enhancements

  • Breaking: the minimum Python version has been bumped to 3.6.2

  • Always add AsyncIterator to imports if there are services #264

  • Allow parsing of messages from ByteString #266

  • Add support for proto3 optional #281

Bugfixes

  • Fix compilation of fields with names identical to builtin types #294
  • Fix default values for enum service args #299

v2.0.0-beta3

07 Apr 10:58
02e41af
Compare
Choose a tag to compare
v2.0.0-beta3 Pre-release
Pre-release

Enhancements

  • Generate grpclib service stubs #170
  • Add __version__ attribute to package #134
  • Use betterproto generated messages in the plugin #161
  • Sort the list of sources in generated file headers #164
  • Micro-optimization: use tuples instead of lists for conditions #228
  • Improve datestring parsing #213

Bugfixes

  • Fix serialization of repeated fields with empty messages #180
  • Fix compilation of fields named 'bytes' or 'str' #226
  • Fix json serialization of infinite and nan floats/doubles #215
  • Fix template bug resulting in empty __post_init__ methods #162
  • Fix serialization of zero-value messages in a oneof group #176
  • Fix missing typing and datetime imports #183
  • Fix code generation for empty services #222
  • Fix Message.to_dict and from_dict handling of repeated timestamps and durations #211
  • Fix incorrect routes in generated client when service is not in a package #177

v2.0.0-beta2

24 Nov 22:08
a157f05
Compare
Choose a tag to compare
v2.0.0-beta2 Pre-release
Pre-release
  • Add support for deprecated message and fields #126
  • Add support for recursive messages #130
  • Add support for bool(Message) #142
  • Improve support for Python 3.9 #140 #173
  • Improve keyword sanitisation for generated code #137
  • Fix missing serialized_on_wire when message contains only lists #81
  • Fix circular dependencies #100
  • Fix to_dict enum fields when numbering is not consecutive #102
  • Fix argument generation for stub methods when using import with proto definition #103
  • Fix missing async/await keywords when casing #104
  • Fix mutable default arguments in generated code #105
  • Fix serialisation of default values in oneofs when calling to_dict() or to_json() #110
  • Fix static type checking for grpclib client #124
  • Fix python3.6 compatibility issue with dataclasses #124
  • Fix handling of trailer-only responses #127
  • Refactor plugin.py to use modular dataclasses in tree-like structure to represent parsed data #121
  • Refactor template compilation logic #136
  • Replace use of platform provided protoc with development dependency on grpcio-tools #107
  • Switch to using poe from make to manage project development tasks #118
  • Improve CI platform coverage #128

v2.0.0-beta1

05 Jul 08:32
bde6d06
Compare
Choose a tag to compare
v2.0.0-beta1 Pre-release
Pre-release

Several bugfixes and improvements required or will require small breaking changes, necessitating a new version.
2.0.0 will be released once the interface is stable.

Upgrade Guide

  • Add support for gRPC and stream-stream #83

  • Switch from pipenv to poetry for development #75

  • Fix two packages with the same name suffix should not cause naming conflict #25

  • Fix Import child package from root #57

  • Fix Import child package from package #58

  • Fix Import parent package from child package #59

  • Fix Import root package from child package #60

  • Fix Import root package from root #61

  • Fix ALL_CAPS message fields are parsed incorrectly. #11

v1.2.5

27 May 11:45
ee362a7
Compare
Choose a tag to compare
  • Add .j2 suffix to python template names to avoid confusing certain build tools.

v1.2.4

26 May 20:19
a5effb2
Compare
Choose a tag to compare
  • Enforce utf-8 for reading the readme in setup.py #67
  • Only import types from grpclib when type checking #52
  • Improve performance of serialize/deserialize by caching type information of fields in class #46
  • Support using Google's wrapper types as RPC output values #40
  • Fixes issue where protoc did not recognize plugin.py as win32 application #38
  • Fix services using non-pythonified field names #34
  • Add ability to provide metadata, timeout & deadline args to requests #32