Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cherry-pick latest updates from betterproto #10

Merged
merged 11 commits into from
Apr 30, 2024

Conversation

ClausHolbechArista
Copy link
Contributor

@ClausHolbechArista ClausHolbechArista commented Apr 29, 2024

  • Bringing fork up to date with the latest changes from betterproto
  • Fixes after cherry-picks
  • Bumping to version 1.2
  • Fix CI

cclauss and others added 10 commits April 29, 2024 20:13
* betterproto: support `Struct` and `Value`

Signed-off-by: William Woodruff <[email protected]>

* betterproto: handle struct in to_dict as well

Signed-off-by: William Woodruff <[email protected]>

* tests: add Struct roundtrip tests

Signed-off-by: William Woodruff <[email protected]>

* specialize from_dict and to_dict on Struct

...rather than special-casing in the Message ABC.

Signed-off-by: William Woodruff <[email protected]>

* betterproto: `poe format`

Signed-off-by: William Woodruff <[email protected]>

* Update src/betterproto/__init__.py

Co-authored-by: James Hilton-Balfe <[email protected]>

* remove future annotations

Signed-off-by: William Woodruff <[email protected]>

* replace type[...] with typing.T

Signed-off-by: William Woodruff <[email protected]>

* quote instead

Signed-off-by: William Woodruff <[email protected]>

---------

Signed-off-by: William Woodruff <[email protected]>
Co-authored-by: James Hilton-Balfe <[email protected]>
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.
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.
* ci: Use GITHUB_OUTPUT envvar instead of set-output command

* Quote envvar to match documentation
* Add betterproto.Enum __copy__ and __deepcopy__ implementations

betterproto.Enum is missing __copy__ and __deepcopy__ implementations, which were recently added to enum.Enum, see python/cpython#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 <[email protected]>

* Type hint on Enum.__deepcopy__

Co-authored-by: James Hilton-Balfe <[email protected]>

---------

Co-authored-by: James Hilton-Balfe <[email protected]>
* 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
@ClausHolbechArista ClausHolbechArista marked this pull request as ready for review April 29, 2024 19:06
@ClausHolbechArista ClausHolbechArista merged commit e464763 into aristanetworks:main Apr 30, 2024
14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants