* Add test
* To run the workflow
* Fix import
* Format
* Add warning
* Fix indentation
* Test deprecated method
* More test
* Format
* Add import if needed
---------
Co-authored-by: Adrien Vannson <adrien.vannson@gardacp.com>
* Pydantic V2 support
* Support Python 3.8
* Mark as classmethod
* Remove max int validation
* Run poe format
* Merge develop
* Revert dataclasses import
* Fix revert
* Drop 3.7 from ci
Currently, CI is broken for 3.7 as github runs its macos images on arm and doesn't provide arm images for 3.7. As 3.7 is deprecated the best (at least interim) solution would be to drop 3.7 checks entirely.
* feat: pydantic version of google pb
* fix: patch pb Struct to support json, dict rountrip
* fix: pydantic-version google pb, json, dict rntrip
* chore: remove `@generated`, remove gen, code fmt
* chore: test case for pydantic-version google pb
* Add betterproto.Enum __copy__ and __deepcopy__ implementations
betterproto.Enum is missing __copy__ and __deepcopy__ implementations, which were recently added to enum.Enum, see https://github.com/python/cpython/issues/106602
This fixes the bug where betterproto messages with Enums nested within cannot be copied via copy.deepcopy.
* Type hint on Enum.__copy__
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* Type hint on Enum.__deepcopy__
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
---------
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
PLACEHOLDER is a specific instance of an object, the test here should be "is not" instead of "!="
I am experimenting with adding ndarray support, and the equality test here causes problems.
Removed the parts of the example that showed accessing an unset value, as it now raises an `AttributeError`, and added an example of the `match` way of accessing the attributes.
Related to #510 and #358.
* betterproto: support `Struct` and `Value`
Signed-off-by: William Woodruff <william@trailofbits.com>
* betterproto: handle struct in to_dict as well
Signed-off-by: William Woodruff <william@trailofbits.com>
* tests: add Struct roundtrip tests
Signed-off-by: William Woodruff <william@trailofbits.com>
* specialize from_dict and to_dict on Struct
...rather than special-casing in the Message ABC.
Signed-off-by: William Woodruff <william@trailofbits.com>
* betterproto: `poe format`
Signed-off-by: William Woodruff <william@trailofbits.com>
* Update src/betterproto/__init__.py
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
* remove future annotations
Signed-off-by: William Woodruff <william@trailofbits.com>
* replace type[...] with typing.T
Signed-off-by: William Woodruff <william@trailofbits.com>
* quote instead
Signed-off-by: William Woodruff <william@trailofbits.com>
---------
Signed-off-by: William Woodruff <william@trailofbits.com>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Continuing work from #484 by @kevinaud to fix#419
* Implementing pickle methods
* Implement __copy__, __reduce__, and fix __setstate__
* Moved pickling tests into their own file
* Add test for caching
* Add support for streaming delimited messages
This allows developers to easily dump and load multiple messages
from a stream in a way that is compatible with official
protobuf implementations (such as Java's
`MessageLite#writeDelimitedTo(...)`).
* Add Java compatibility tests for streaming
These tests stream data such as messages to output files, have a
Java binary read them and then write them back using the
`protobuf-java` functions, and then read them back in on the Python
side to check that the returned data is as expected. This checks
that the official Java implementation (and so any other matching
implementations) can properly parse outputs from Betterproto, and
vice-versa, ensuring compatibility in these functions between the
two.
* Replace `xxxxableBuffer` with `SupportsXxxx`