43 Commits

Author SHA1 Message Date
James Hilliard
dbc612c7f3 Update all dependencies and actions 2025-01-14 17:07:48 +01:00
James Hilliard
f33a42b082
Update metadata to use PEP 621 (#654)
* Drop python version 3.8 support
* Add python 3.13 support in CI
2025-01-14 15:42:13 +01:00
Stanislav Bobokalo
37fa3abbac
docs: change outdated Slack link to a Discord one (#653) 2024-12-20 00:14:37 +00:00
Emmanuel Ferdman
34b8249b91
Update tests readme reference (#623) 2024-10-15 21:02:26 +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
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
Christian Clauss
ce5093eec0
Upgrade actions to 3.12 (#550) 2024-01-02 14:49:16 +00:00
James Hilton-Balfe
1dd001b6d3
Add CodeQL scanning (#418) 2023-10-18 09:55:28 +11:00
James Hilton-Balfe
6b36b9ba9f
Add issue templates (#166) 2023-10-16 14:23:14 +11:00
konstantin
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
James Hilton-Balfe
6df8cef3f0
Fix CI (#456) 2023-02-13 00:20:58 +00:00
James Hilton-Balfe
1b1bd47cb1
Drop support for python3.6 (#444) 2023-02-09 08:35:41 +00:00
Arun Babu Neelicattu
a836fb23bc
Configure pre-commit for project (#346) 2022-03-03 18:10:01 +00:00
Arun Babu Neelicattu
bd69862a02
test input: use explicit package declaration (#345) 2022-03-03 13:34:53 +00:00
Kalan
573c7292a6
Add Python 3.10 to GitHub Actions test matrix (#280)
Co-authored-by: James Hilton-Balfe <50501825+Gobot1234@users.noreply.github.com>
2021-12-29 23:10:34 +00:00
Kalan
d77f44ebb7
Support proto3 field presence (#281)
* Update protobuf pregenerated files

* Update grpcio-tools to latest version

* Implement proto3 field presence

* Fix to_dict with None optional fields.

* Add test with optional enum

* Properly support optional enums

* Add tests for 64-bit ints and floats

* Support field presence for int64 types

* Fix oneof serialization with proto3 field presence (#292)

= Description

The serialization of a oneof message that contains a message with fields
with explicit presence was buggy.

For example:

```
message A {
    oneof kind {
        B b = 1;
        C c = 2;
    }
}

message B {}
message C {
    optional bool z = 1;
}
```

Serializing `A(b=B())` would lead to this payload:

```
0A # tag1, length delimited
00 # length: 0
12 # tag2, length delimited
00 # length: 0
```

Which when deserialized, leads to the message `A(c=C())`.

= Explanation

The issue lies in the post_init method. All fields are introspected, and
if different from PLACEHOLDER, the message is marked as having been
"serialized_on_wire".
Then, when serializing `A(b=B())`, we go through each field of the
oneof:

- field 'b': this is the selected field from the group, so it is
  serialized
- field 'c': marked as 'serialized_on_wire', so it is added as well.

= Fix

The issue is that support for explicit presence changed the default
value from PLACEHOLDER to None. This breaks the post_init method in that
case, which is relatively easy to fix: if a field is optional, and set
to None, this is considered as the default value (which it is).

This fix however has a side-effect: the group_current for this field (the
oneof trick for explicit presence) is no longer set. This changes the
behavior when serializing the message in JSON: as the value is the
default one (None), and the group is not set (which would force the
serialization of the field), so None fields are no longer serialized in
JSON. This break one test, and will be fixed in the next commit.

* fix: do not serialize None fields in JSON format

This is linked to the fix from the previous commit: after it, scalar
None fields were not included in the JSON format, but some were still
included.

This is all cleaned up: None fields are not added in JSON by default,
as they indicate the default value of fields with explicit presence.
However, if `include_default_values is set, they are included.

* Fix: use builtin annotation prefix

* Remove comment

Co-authored-by: roblabla <unfiltered@roblab.la>
Co-authored-by: Vincent Thiberville <vthib@pm.me>
2021-12-29 13:38:32 -08:00
Kalan
a4d2d39546
Fix Python 3.9 Tests (#284)
Co-authored-by: James Hilton-Balfe <50501825+Gobot1234@users.noreply.github.com>
2021-11-19 21:32:36 +00:00
Arun Babu Neelicattu
a8a082e4e7
Update dependencies and add ci checks for python 3.9 (#173)
* Update locked dependencies to fix grpcio compile issue with python 3.9
* ci: add python 3.9
2020-11-24 19:28:28 +01:00
Tim Schmidt
e44de6da06
replace now-disabled set-env command (#172)
thanks @abn
2020-11-21 14:42:50 +01:00
James
a5e0ef910f
Fixes for Python 3.9 (#140)
Fix issue in logic for evaluating field types affecting python 3.9
2020-11-01 15:23:02 +01:00
James
8f7af272cc
QOL fixes (#141)
- Add missing type annotations
- Various style improvements
- Use constants more consistently
- enforce black on benchmark code
2020-10-17 19:27:11 +02:00
James
d3e4fbb311
Add Documentation (#125)
Add sphinx docs with readthedocs integration.

Docs can be built locally with `poe docs`.
2020-09-20 22:00:02 +02:00
Arun Babu Neelicattu
43c134d27c
ci: refactor jobs and improve platform coverage (#128) 2020-07-30 14:47:38 +02:00
nat
c513853301
Replace Makefile with poe tasks in pyproject.yaml (#118)
https://github.com/nat-n/poethepoet
2020-07-25 19:54:40 +02:00
boukeversteegh
2585a07fcf Improve poetry install speed by first upgrading pip 2020-07-12 15:42:31 +02:00
Arun Babu Neelicattu
03211604bc Replace dependency on protoc with grpcio-tools
This change removes the dependency on platform provided protobuf tools
in favour of `grpcio-tools` dependency. This makes both development and
compiler use independent from platform dependencies.
2020-07-10 13:16:40 +02:00
Nat Noordanus
4f820b4a6a Include python 3.8 i ci test runs & optimise CI and make config 2020-06-22 19:38:41 +02:00
Nat Noordanus
75a4c230da Add optional deps to dev-deps
So contributors dont have to remember to run poetry install with `-E compiler`
2020-06-22 19:35:23 +02:00
Nat Noordanus
8edec81b11 Switch from pipenv to poetry
- dropped dev dependency on rope, isort & flake
- poetry doesn't support dev scripts like pipenv, so create a makefile instead
- Add pytest-cov
- Use tox for testing multiple python versions in CI
- Update README

Update ci workflow
2020-06-12 21:13:55 +02:00
Nat Noordanus
3860c0ab11 Add task to run black --check in ci & update README 2020-05-27 11:52:10 +02:00
Nat Noordanus
9b990ee1bd Make pipenv play nice with the setup-python ci workflow 2020-04-05 15:58:12 +02:00
Nat Noordanus
203105f048 Add support for python 3.6
Changes:
- Update config and docs to reference 3.6
- Add backports of dataclasses and datetime.fromisoformat for python_version<"3.7"
- Support both 3.7 and 3.6 usages of undocumented __origin__ attribute on typing objects
- Make github ci run tests for python 3.6 as well
2020-04-03 19:52:19 +02:00
Daniel G. Taylor
ba520f88a4
Install Protobuf include files on CI host 2019-10-27 15:40:33 -07:00
Daniel G. Taylor
b0b64fcbaf
Fix tests attempt 3 2019-10-27 15:29:04 -07:00
Daniel G. Taylor
7900c7c9db
Fix tests 2019-10-27 15:21:20 -07:00
Daniel G. Taylor
fcc273e294
Fix tests 2019-10-27 15:18:10 -07:00
Daniel G. Taylor
ef0a1bf50c
Use specific version of pypi publish image 2019-10-23 15:03:13 -07:00
Daniel G. Taylor
0e389abbef
Add Python package long description 2019-10-22 21:31:42 -07:00
Daniel G. Taylor
45a6da0fad
CI updates 2019-10-20 23:46:50 -07:00
Daniel G. Taylor
972ed4635a
Try pip user install and path update 2019-10-20 23:36:47 -07:00
Daniel G. Taylor
487bdf9f16
Update CI build 2019-10-20 23:32:09 -07:00
Daniel G. Taylor
1fd24f74fc
Fix CI dependency install 2019-10-20 23:26:48 -07:00
Daniel G. Taylor
f4389a29ec
Add GitHub action build for CI 2019-10-20 23:25:18 -07:00