From 6fd9612ee1543549425a974c5180d7fb1c1a1f7e Mon Sep 17 00:00:00 2001 From: "Daniel G. Taylor" Date: Sun, 27 Oct 2019 15:43:52 -0700 Subject: [PATCH] Doc updates, version bump for release --- README.md | 9 +++++++++ setup.py | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 68c6700..ed29198 100644 --- a/README.md +++ b/README.md @@ -10,6 +10,7 @@ This project aims to provide an improved experience when using Protobuf / gRPC i - Enums - Dataclasses - `async`/`await` + - Timezone-aware `datetime` and `timedelta` objects - Relative imports - Mypy type checking @@ -34,6 +35,8 @@ This project exists because I am unhappy with the state of the official Google p - Much code looks like C++ or Java ported 1:1 to Python - Capitalized function names like `HasField()` and `SerializeToString()` - Uses `SerializeToString()` rather than the built-in `__bytes__()` + - Special wrapped types don't use Python's `None` + - Timestamp/duration types don't use Python's built-in `datetime` module This project is a reimplementation from the ground up focused on idiomatic modern Python to help fix some of the above. While it may not be a 1:1 drop-in replacement due to changed method names and call patterns, the wire format is identical. @@ -168,6 +171,12 @@ Both serializing and parsing are supported to/from JSON and Python dictionaries - Dicts: `Message().to_dict()`, `Message().from_dict(...)` - JSON: `Message().to_json()`, `Message().from_json(...)` +For compatibility the default is to convert field names to `camelCase`. You can control this behavior by passing a casing value, e.g: + +```py +>>> MyMessage().to_dict(casing=betterproto.Casing.SNAKE) +``` + ### Determining if a message was sent Sometimes it is useful to be able to determine whether a message has been sent on the wire. This is how the Google wrapper types work to let you know whether a value is unset, set as the default (zero value), or set as something else, for example. diff --git a/setup.py b/setup.py index a2fd4d2..ec41f6a 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ from setuptools import setup, find_packages setup( name="betterproto", - version="1.0.1", + version="1.1.0", description="A better Protobuf / gRPC generator & library", long_description=open("README.md", "r").read(), long_description_content_type="text/markdown",