Commit Graph
53 Commits
Author SHA1 Message Date
natandGitHub 02e41afd09 Release v2.0.0b3 (#182)
Updated change log to include all new features and fixes from master.
2021-04-07 12:57:44 +02:00
natandGitHub 7368299a70 Fix serialization of repeated fields with empty messages (#180)
Extend test config and utils to support exclusion of certain json samples from
testing for symetry.
2021-04-06 10:50:45 +10:00
deb623ed14 Fix compilation of fields named 'bytes' or 'str' (#226)
* if you have a field named "bytes" using the bytes type, it doesn't work.
* Enable existing use-case & generalize solution to cover it

Co-authored-by: Spencer <spencer@sf-n.com>
2021-04-06 10:45:57 +10:00
natandGitHub 95339bf74d Misc cleanup, see commit body (#227)
- Enable oneof_enum test case that passes now (removed the xfail)
- Switch from toml to tomlkit as a dev dep for better toml support
- upgrade poethepoet to latest stable release
- use full table format for poe tasks to avoid long lines in pyproject.toml
- remove redundant _WrappedMessage class
- fix various Mypy warnings
- reformat some comments for consistent line length
2021-04-06 10:43:09 +10:00
natandGitHub 5b639c82b2 Micro-optimization: use tuples instead of lists for conditions (#228)
This should give a small speed boost to some critical code paths.
2021-04-06 10:40:45 +10:00
Nat NoordanusandBasileus bb646fe26f Fix template bug resulting in empty __post_init__ methods 2021-04-02 10:13:08 +11:00
Nat NoordanusandBasileus fc90653ab1 Sort the list of sources in generated file headers 2021-04-02 10:13:00 +11:00
Nat NoordanusandBasileus 2a73dbac98 Make plugin use betterproto generated classes internally
This means the betterproto plugin no longer needs to depend durectly on
protobuf.

This requires a small runtime hack to monkey patch some google types to
get around the fact that the compiler uses proto2, but betterproto
expects proto3.

Also:
- regenerate google.protobuf package
- fix a regex bug in the logic for determining whether to use a google
  wrapper type.
- fix a bug causing comments to get mixed up when multiple proto files
  generate code into a single python module
2021-04-02 10:13:00 +11:00
natandGitHub 891c9e5d6c Update readme to avoid confusion about unreleased features. (#223) 2021-04-01 20:40:02 +02:00
Nat NoordanusandBasileus a890514b5c Update deps & add generate_lib task
- Remove plugin dependency on protobuf since it's no longer required.
- Update poethepoet to for better pyproject toml syntax support
- Add handy generate_lib poe task for maintaining generated libs
2021-04-01 09:49:22 +11:00
Nat NoordanusandBasileus fe1e712fdb Make plugin use betterproto generated classes internally
This means the betterproto plugin no longer needs to depend durectly on
protobuf.

This requires a small runtime hack to monkey patch some google types to
get around the fact that the compiler uses proto2, but betterproto
expects proto3.

Also:
- regenerate google.protobuf package
- fix a regex bug in the logic for determining whether to use a google
  wrapper type.
- fix a bug causing comments to get mixed up when multiple proto files
  generate code into a single python module
2021-04-01 09:49:22 +11:00
342e6559dc Properly serialize zero-value messages in a oneof group (#176)
Also improve test utils to make it easier to have multiple json examples.

Co-authored-by: Christopher Chambers <chris@peanutcode.com>
2021-03-15 13:52:35 +01:00
natandGitHub 59f5f88c0d Rebuild poetry.lock to fix CI (#202) 2021-01-25 20:28:30 +01:00
natandGitHub 73cea12e1f Fix incorrect routes in generated client when service is not in a package (#177) 2020-11-28 17:50:25 +01:00
natandGitHub 804805f0f5 Update poe (#132)
- This update improves support for windows & removes the direct dependency on poetry
2020-08-06 22:16:25 +02:00
natandGitHub c513853301 Replace Makefile with poe tasks in pyproject.yaml (#118)
https://github.com/nat-n/poethepoet
2020-07-25 19:54:40 +02:00
natandGitHub 5a591ef2a4 Add link to testing README in CONTRIBUTING.md 2020-07-09 20:41:13 +02:00
natandGitHub 0c5d1ff868 Merge branch 'master' into client-streaming 2020-06-23 22:02:23 +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 5c9a12e2f6 Merge pull request #1 from boukeversteegh/client-streaming-tests
Client streaming tests
2020-06-16 19:36:40 +02:00
Nat Noordanus e1ccd540a9 Fix bugs and remove footgun feature in AsyncChannel 2020-06-16 00:07:28 +02:00
natandGitHub 4e78fe9579 Merge branch 'client-streaming' into client-streaming-tests 2020-06-15 23:42:01 +02:00
Nat Noordanus 50bb67bf5d Fix bugs and remove footgun feature in AsyncChannel 2020-06-15 23:35:56 +02:00
Nat Noordanus c8229e53a7 Fix most mypy warnings 2020-06-15 00:19:07 +02:00
Nat Noordanus 3185c67098 Improve generate script
- Fix issue with __pycache__ dirs getting picked up
- parallelise code generation with asyncio for 3x speedup
- silence protoc output unless -v option is supplied
- Use pathlib ;)
2020-06-15 00:19:07 +02:00
Nat Noordanus 4b6f55dce5 Finish implementation and testing of client
Including stream_unary and stream_stream call methods.

Also
- improve organisation of relevant tests
- fix some generated type annotations
- Add AsyncChannel utility cos it's useful
2020-06-14 23:04:52 +02:00
Nat Noordanus 09f821921f Move ServiceStub to a seperate module and add more rpcs to service test 2020-06-14 22:19:51 +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
natandGitHub a46979c8a6 Merge pull request #86 from danielgtaylor/boukeversteegh-patch-1
Add Slack invite link
2020-06-11 17:26:38 +02:00
natandGitHub 9a45ea9f16 Merge pull request #78 from boukeversteegh/pr/google
Basic general support for Google Protobuf
2020-06-11 10:50:12 +02:00
nat 91111ab7d8 Make plugin import errors more helpful
This addresses an issue where if the user happens to have black installed in
their environment but not the other dependencies when running the protoc
plugin then the resulting import error (No module named 'google') is not very
helpful.
2020-05-30 16:08:36 +02:00
natandGitHub ee362a7a73 Merge pull request #73 from nat-n/always_black
Bump version to 1.2.5
2020-05-27 13:37:54 +02:00
natandGitHub 261e55b2c8 Merge pull request #72 from nat-n/always_black
Make CI check formatting is black & append .j2 suffix to template.py
2020-05-27 12:27:33 +02:00
Nat Noordanus 98930ce0d7 Bump version to 1.2.5 2020-05-27 12:04:53 +02:00
Nat Noordanus d7d277eb0d Remove typo from Pipfile and update Pipfile.lock 2020-05-27 11:52:18 +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 cd1c2dc3b5 Rename template file to avoid confusing black or other build tools 2020-05-27 11:25:19 +02:00
Nat Noordanus be2a24d15c blacken 2020-05-27 11:25:00 +02:00
natandGitHub a68505b80e Enforce utf-8 for reading the readme
Fixes failing installation issue #66
2020-05-25 17:53:13 +02:00
natandGitHub 2f9497e064 Merge pull request #55 from boukeversteegh/pr/xfail-tests
Add intentionally failing test-cases for unimplemented bug-fixes
2020-05-25 09:54:26 +02:00
natandGitHub 0fe557bd3c Merge pull request #52 from nat-n/fix_type_imports
Only import types from grpclib when type checking
2020-05-24 19:09:08 +02:00
natandGitHub 1a87ea43a1 Merge pull request #40 from boukeversteegh/pr/wrapper-as-output
Support using Google's wrapper types as RPC output values
2020-05-24 19:06:30 +02:00
natandGitHub 4a2baf3f0a Merge pull request #46 from jameslan/perf/class-cache
Improve performance of serialize/deserialize by caching type information of fields in class
2020-05-24 18:38:32 +02:00
Nat Noordanus 5e2d9febea Blacken 2020-05-23 23:37:22 +02:00
natandGitHub f6af077ffe Merge pull request #51 from boukeversteegh/pr/refactor-tests
Reorganize tests and add some extra documentation.
2020-05-22 22:32:37 +02:00
Nat Noordanus 91f586f7d7 Apply black formatting 2020-05-22 18:46:43 +02:00
Nat Noordanus 33fb83faad Only import types from grpclib when type checking 2020-05-22 18:41:29 +02:00
natandGitHub 3546f55146 Merge pull request #32 from nat-n/improve_stub
Add ability to provide metadata, timeout & deadline args to requests
2020-05-21 10:11:45 +02:00
Nat Noordanus 5759e323bd Add ability to provide metadata, timeout & deadline args to requests
This is an enhancement of the ServiceStub abstract class that makes
it more useful by making it possible to pass all arguments supported
by the underlying grpclib request function.

It extends to the existing high level API by allowing values to be
set on the stub instance, and the low level API by allowing values
to be set per call.
2020-04-12 22:23:10 +02:00
Nat Noordanus c762c9c549 Add test for generated service stub
- Create one simple test for generated Service stubs in preparation
for making more changes in this area.
- Add dev dependency on pytest-asyncio in order to use ChannelFor
from grpclib.testing more easily.
- Create a new example proto containing a minimal rpc example.
2020-04-12 19:37:39 +02:00
Nat Noordanus 582a12577c Fix test instructions to match pipfile 2020-04-12 18:52:43 +02:00
Nat Noordanus 9b990ee1bd Make pipenv play nice with the setup-python ci workflow 2020-04-05 15:58:12 +02:00