Commit Graph
409 Commits
Author SHA1 Message Date
Georg K 9ed579fa35 fix: datetime offsets 2023-11-20 22:46:34 +03:00
Georg K 1d296f1a88 Merge branch 'master_gh'
# Conflicts:
#	src/betterproto/__init__.py
2023-11-15 17:33:19 +03:00
bd7de203e1 Remove Enum prefixes (#187)
Co-authored-by: nat <n@natn.me>
Co-authored-by: Tim Schmidt <w4rum@users.noreply.github.com>
Co-authored-by: Arun Babu Neelicattu <arun.neelicattu@gmail.com>
2023-10-25 22:35:16 +01:00
d9b7608980 Support Message.from_dict() as a class and an instance method (#476)
* Make Message.from_dict() a class method

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>

* Sync 1/2 of review comments

* Sync other half

* Update .pre-commit-config.yaml

* Update __init__.py

* Update utils.py

* Update src/betterproto/__init__.py

* Update .pre-commit-config.yaml

* Update __init__.py

* Update utils.py

* Fix CI again

* Fix failing formatting

---------

Signed-off-by: Marek Pikuła <marek.pikula@embevity.com>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-10-25 22:20:23 +01:00
02aa4e88b7 Fix _Timestamp edge cases (#534)
* Add failing test cases for timestamp conversion

* Fix timestamp to datetime conversion

* Fix formatting

* Move timestamp tests outside of inputs folder

---------

Co-authored-by: Lukas Bindreiter <lukas.bindreiter@tilebox.io>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-10-18 00:41:09 +01:00
James Hilton-BalfeandGitHub 1dd001b6d3 Add CodeQL scanning (#418) 2023-10-18 09:55:28 +11:00
Sebastian PietrasandGitHub e309513131 Fix _stream_unary not working with empty iterables (#422)
* Fixed `do_many_things` method in `ThingService`
* Added test for empty iterables
* Fixed `_stream_unary` not sending request first
2023-10-18 09:54:23 +11:00
Joshua LeiversandGitHub 24db53290e Fix Tox to use Poetry hermetically (#531) 2023-10-17 14:56:58 +01:00
James Hilton-BalfeandGitHub 2bcb05a905 Tests for #523 (#538) 2023-10-16 22:33:42 +11:00
VasiliosandGitHub ca6b9fe1a2 Implementing pickle methods (#535)
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
2023-10-16 22:17:15 +11:00
Joshua LeiversandGitHub 4f18ed1325 Add support for streaming delimited messages (#529)
* 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`
2023-10-16 21:59:33 +11:00
James Hilton-BalfeandGitHub 6b36b9ba9f Add issue templates (#166) 2023-10-16 14:23:14 +11:00
GirtsandGitHub 61d192e207 test for issue #305, marked with xfail (#306) 2023-10-16 14:18:24 +11:00
Erik FrieseandGitHub 8b5dd6c1f8 Dont set group for optional fields (#528)
Fixes #523
2023-10-16 13:43:42 +11:00
Micael JarniacandGitHub 3514991133 Rich support (#508)
Closes #507

https://rich.readthedocs.io/en/latest/pretty.html#rich-repr-protocol
2023-10-16 13:36:26 +11:00
James Hilton-BalfeandGitHub e3b44f491f Fix timestamp parsing (#415)
Fixes #407
2023-10-16 13:35:32 +11:00
c82816b8be Map enum int's into Enums redux (#293)
Re-implement Enum to be faster along with being an open set

---------
Co-authored-by: ydylla <ydylla@gmail.com>
2023-10-16 13:32:30 +11:00
Georg K aa81680c83 Merge branch 'master_gh' 2023-08-31 00:51:55 +03:00
Joshua LeiversandGitHub 8659c51123 Add message streaming support (#518) 2023-08-29 14:26:25 +01:00
Georg K 0fda2cc05d Merge branch 'master_gh' 2023-08-11 02:56:45 +03:00
AndrewandGitHub 4cdf1bb9e0 Fix Message equality comparison (#513) 2023-07-29 12:06:56 +01:00
Georg K d203659a44 Merge branch 'master_gh' 2023-07-27 00:06:35 +03:00
Alexander KhabarovandGitHub 6faac1d1ca Raise AttributeError on attempts to access unset oneof fields (#510) 2023-07-21 13:26:30 +01:00
098989e9e9 Bump version to 2.0.0b6 (#500)
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-06-26 00:12:49 +01:00
182aedaec4 Handle empty value objects properly (#481)
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-06-24 20:19:13 +01:00
a7532bbadc Add Python 3.11 to CI Runs (#445)
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-06-24 19:49:34 +01:00
Alexander KhabarovandGitHub 73d1fa3d5b Upgrade grpcio-tools and protobuf (#498) 2023-06-24 19:39:11 +01:00
Sriansh Raj PradhanandGitHub c00bc96db7 Create LICENSE.md (#502) 2023-06-16 19:19:51 +01:00
Georg K d3e9621aa8 Merge branch 'master_gh' 2023-05-29 17:18:33 +03:00
Nick DeRobertisandGitHub fcbd8a3759 Fix pydict serialization for optional fields (#495) 2023-05-28 17:47:52 +01:00
pi-slhandGitHub aad7d2ad76 Replace pkg_resources with importlib (#462) 2023-05-25 11:12:15 +01:00
Georg K 37e53fce85 Merge branch 'master_gh' 2023-05-05 03:27:56 +03:00
2b41383745 Fix dict encoding for timezone aware datetimes (#468)
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2023-04-13 23:34:19 +01:00
Marek PikułaandGitHub b0b6cd24ad Fix pydantic_dataclasses reference in README (#474) 2023-04-13 21:56:38 +01:00
Georg K b81195eb44 fix: _Timestamp.to_datetime works with negative ts 2023-04-05 13:02:25 +03:00
Georg K d2af2f2fac Merge branch 'master_gh' 2023-04-05 12:51:02 +03:00
James Hilton-BalfeandGitHub e7f07fa2a1 Update __init__.py (#451) 2023-03-08 08:20:56 +00:00
Georg K 50fa4e6268 fix: protoc to local 2023-03-02 21:55:15 +03:00
Samuel YvonandGitHub 2fa0be2141 Fix for #459 (pydantic code gen only) (#460) 2023-02-21 19:41:32 +00:00
Samuel YvonandGitHub 13d656587c Add support for pydantic dataclasses (#406) 2023-02-13 15:37:16 +00:00
James Hilton-BalfeandGitHub 6df8cef3f0 Fix CI (#456) 2023-02-13 00:20:58 +00:00
James Hilton-BalfeandGitHub 1b1bd47cb1 Drop support for python3.6 (#444) 2023-02-09 08:35:41 +00:00
Wouter HorréandGitHub 0adcc9020c Pythonize input_type name in py_input_message (#436)
Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>
Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
Fixes https://github.com/danielgtaylor/python-betterproto/issues/427
Fixes https://github.com/danielgtaylor/python-betterproto/issues/438
2022-12-02 22:18:48 +00:00
sterliakovandGitHub bfc0fac754 Enforce serialize_empty for repeated fields (#417) 2022-08-31 18:59:12 +01:00
Antonín ŘíhaandGitHub 8fbf4476a8 Fix typechecker compatiblity checks in server streaming methods (#413) 2022-08-31 00:05:29 +01:00
Samuel YvonandGitHub 591ec5efb3 Pull down the include_default_values argument to to_json (#405) 2022-08-08 14:26:28 +01:00
Antonín ŘíhaandGitHub f31d51cf3c Added support for @generated marker (#382) 2022-08-03 11:05:13 +01:00
James Hilton-BalfeandGitHub 496eba2750 Bump version to b5 (#404) 2022-08-02 09:23:44 +10:00
d663a318b7 Release v.2.0.0b5 (#350)
* Implement Message.__bool__ for #130
* Add __bool__ to special members
* Tweak __bool__ docstring
* remove compiler: prefix

Co-authored-by: nat <n@natn.me>
2022-08-02 08:59:44 +10:00
Justin TorreandGitHub 2fb37dd108 Update Jinja 2 version (#402) 2022-08-01 10:44:37 +01:00