452 Commits

Author SHA1 Message Date
Georg K
f8ecc42478 Merge branch 'refs/heads/master_gh' 2024-10-13 03:14:00 +03:00
Adrien
c2bcd31fe3
Remove error when no fields are set in oneof (#612) 2024-10-05 13:13:44 +01:00
Adrien
c9dfe9ab1f
Remove unused compiler functions (#619) 2024-10-05 13:10:22 +01:00
Michał Górny
32d642d2a0
Update no-warning tests for pytest-8 (#622)
Replace the deprecated `pytest.warns(None)` with the suggested
replacement (from https://github.com/pytest-dev/pytest/issues/9404)
to make the test suite forward compatible with pytest-8.  This works
correctly with pytest-6 as well.
2024-10-05 13:08:49 +01:00
Adrien
1161803069
Fix placeholder deep copy (#611)
* Fix placeholder deep copy

* Add annotations, __repr__ and __slots__

Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>

* Fix annotation

* Fix typing

---------

Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2024-09-18 12:56:51 +01:00
Adrien
8d25c96cea
Simplify code: delete py_input_message (#614) 2024-09-17 16:05:35 +01:00
Adrien
8fdcb381b7
Prevent users from creating messages with wrong parameters when pydantic is used (#615) 2024-09-12 18:34:47 +01:00
Georg K
4cf6e7d95c fix: prefix to "4" 2024-09-10 19:42:42 +03:00
Georg K
63458e2da0 Merge branch 'master_gh' 2024-09-10 19:41:24 +03:00
Adrien
efaef5095c
Fix badge URL (#602)
The badge always shows the build as failing, even if it is actually successful.

This issue has been reported on https://github.com/actions/starter-workflows/issues/1525 , and the fix suggested on https://github.com/actions/starter-workflows/issues/1525#issuecomment-1763431305 works.
2024-08-31 15:49:14 +01:00
Ajit Krishna
1538e156a1
Bump version to 2.0.0b7 (#593)
* Bump version to 2.0.0b7

* chore: changes to changelog from PR comments

* chore: grammar fix

* Add entry for #596

* Apply suggestions from code review

---------

Co-authored-by: James Hilton-Balfe <gobot1234yt@gmail.com>
2024-08-14 22:16:59 +01:00
Adrien
4e9a17c227
Add warnings when calling deprecated method (#596)
* 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>
2024-08-14 21:33:43 +01:00
James Hilton-Balfe
f96f51650c
fix: 3.10 style imports not resolving correctly (#594) 2024-08-14 08:01:31 +01:00
Georg K
970624fe08 feat: update to ext_fix = 3 2024-07-30 22:11:38 +03:00
Georg K
32eaa51e8d Merge branch 'refs/heads/master_gh' 2024-07-30 22:10:55 +03:00
Nicholas Gates
5fdd0bb24f
Update to Pydantic V2 (#588)
* Pydantic V2 support

* Support Python 3.8

* Mark as classmethod

* Remove max int validation

* Run poe format

* Merge develop

* Revert dataclasses import

* Fix revert
2024-07-23 14:43:31 +01:00
Ian McDonald
8b59234856
Handle typing collisions and add validation to a files module for overlaping declarations (#582)
* Fix 'typing' import collisions.

* Fix formatting.

* Fix self-test issues.

* Validation for modules, different typing configurations

* add readme

* make warning

* fix format

---------

Co-authored-by: Scott Hendricks <scott.hendricks@confluent.io>
2024-07-20 00:02:09 +01:00
Ian McDonald
7c6c627938
Drop 3.7 from ci (#587)
* 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.
2024-07-19 15:44:14 +10:00
Georg K
696b7ae9fc bump: EXT_FIX to 2 2024-04-17 06:15:26 +03:00
Georg K
6dce440975 Merge branch 'refs/heads/master_gh' 2024-04-17 06:14:54 +03:00
Erik Friese
1f88b67eeb
betterproto-rust-codec updated (#571) 2024-04-13 15:16:33 +01:00
Georg K
1f79bdd7e4 fix: poetry build 2024-04-11 21:13:05 +03:00
Georg K
6606cd3bb9 fix: version 2024-04-11 21:08:39 +03:00
Georg K
576f878ddc fix: pypi version 2024-04-11 21:08:08 +03:00
Georg K
6bdfa67fa1 fix: poetry publish 2024-04-09 03:16:54 +03:00
Georg K
b075402a93 fix: poetry publish 2024-04-09 03:14:30 +03:00
Georg K
49ac12634b feat: add musl-dev 2024-04-09 03:08:09 +03:00
Georg K
a7f0d028ff feat: add gcc 2024-04-09 03:02:35 +03:00
Georg K
acca29731f fix: python version 2024-04-09 03:00:10 +03:00
Georg K
ecbe8dc04d feat: add gitlab-ci 2024-04-09 02:58:30 +03:00
Georg K
85d2990ca1 Merge branch 'refs/heads/master_gh'
# Conflicts:
#	pyproject.toml
2024-04-09 02:37:34 +03:00
Maple
c3c20556e0
fix: support pydantic-version google pb (#568)
* 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
2024-04-08 23:54:36 +01:00
atomicmac
df1ba911b7
Add betterproto.Enum __copy__ and __deepcopy__ implementations (#566)
* 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>
2024-03-29 14:08:02 +00:00
Arun Sathiya
126b256b4c
ci: Use GITHUB_OUTPUT envvar instead of set-output command (#553)
* ci: Use GITHUB_OUTPUT envvar instead of set-output command

* Quote envvar to match documentation
2024-03-24 00:56:48 +00:00
atomicmac
e98c47861d
refactor: use is instead of == (#560)
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.
2024-03-23 21:43:56 +00:00
Micael Jarniac
dbd31929d3
Add one-of match example to README (#558)
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.
2024-03-19 21:54:32 +00:00
Georg K
7dee36e073 Merge branch 'master_gh' 2024-01-09 22:16:02 +03:00
William Woodruff
5666393f9d
betterproto: support Struct and Value (#551)
* 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>
2024-01-02 20:16:15 +00:00
Christian Clauss
ce5093eec0
Upgrade actions to 3.12 (#550) 2024-01-02 14:49:16 +00:00
Georg K
c47e83fe5b Merge branch 'master_gh' 2023-12-19 03:17:27 +03:00
John Collins
b8a091ae70
Turn off doc-string line wrapping (#532) 2023-12-16 13:36:53 +00:00
Georg K
61fc2f4160 Merge branch 'master_gh' 2023-12-13 14:05:14 +03:00
Erik Friese
d34b16993d
Use external package betterproto-rust-codec for better (de-)serialization performance (#545)
* optionally use betterproto-rust-codec
* monkey patch `parse` and `__bytes__`
2023-12-07 11:21:29 +11:00
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
James Hilton-Balfe
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
Marek Pikuła
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
Lukas Bindreiter
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-Balfe
1dd001b6d3
Add CodeQL scanning (#418) 2023-10-18 09:55:28 +11:00
Sebastian Pietras
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