Skip to content

Commit 73609a8

Browse files
Merge branch 'master' into fix/93_skipped_enum_values
2 parents cab47dc + 42e197f commit 73609a8

File tree

140 files changed

+958
-671
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+958
-671
lines changed

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ jobs:
4949
${{ runner.os }}-poetry-
5050
- name: Install dependencies
5151
run: |
52-
sudo apt install protobuf-compiler libprotobuf-dev
5352
poetry install
5453
- name: Run tests
5554
run: |

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
.pytest_cache
77
.python-version
88
build/
9-
betterproto/tests/output_*
9+
tests/output_*
1010
**/__pycache__
1111
dist
1212
**/*.egg-info
1313
output
1414
.idea
1515
.DS_Store
1616
.tox
17+
.venv

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,27 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
- Versions suffixed with `b*` are in `beta` and can be installed with `pip install --pre betterproto`.
9+
10+
## [2.0.0b1] - 2020-07-04
11+
12+
[Upgrade Guide](./docs/upgrading.md)
13+
14+
> Several bugfixes and improvements required or will require small breaking changes, necessitating a new version.
15+
> `2.0.0` will be released once the interface is stable.
16+
17+
- Add support for gRPC and **stream-stream** [#83](https://github.com/danielgtaylor/python-betterproto/pull/83)
18+
- Switch from `pipenv` to `poetry` for development [#75](https://github.com/danielgtaylor/python-betterproto/pull/75)
19+
- Fix two packages with the same name suffix should not cause naming conflict [#25](https://github.com/danielgtaylor/python-betterproto/issues/25)
20+
21+
- Fix Import child package from root [#57](https://github.com/danielgtaylor/python-betterproto/issues/57)
22+
- Fix Import child package from package [#58](https://github.com/danielgtaylor/python-betterproto/issues/58)
23+
- Fix Import parent package from child package [#59](https://github.com/danielgtaylor/python-betterproto/issues/59)
24+
- Fix Import root package from child package [#60](https://github.com/danielgtaylor/python-betterproto/issues/60)
25+
- Fix Import root package from root [#61](https://github.com/danielgtaylor/python-betterproto/issues/61)
26+
27+
- Fix ALL_CAPS message fields are parsed incorrectly. [#11](https://github.com/danielgtaylor/python-betterproto/issues/11)
28+
829
## [1.2.5] - 2020-04-27
930

1031
- Add .j2 suffix to python template names to avoid confusing certain build tools [#72](https://github.com/danielgtaylor/python-betterproto/pull/72)

CONTRIBUTING.md

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
# Contributing
2+
3+
There's lots to do, and we're working hard, so any help is welcome!
4+
5+
- :speech_balloon: Join us on [Slack](https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ)!
6+
7+
What can you do?
8+
9+
- :+1: Vote on [issues](https://github.com/danielgtaylor/python-betterproto/issues).
10+
- :speech_balloon: Give feedback on [Pull Requests](https://github.com/danielgtaylor/python-betterproto/pulls) and [Issues](https://github.com/danielgtaylor/python-betterproto/issues):
11+
- Suggestions
12+
- Express approval
13+
- Raise concerns
14+
- :small_red_triangle: Create an issue:
15+
- File a bug (please check its not a duplicate)
16+
- Propose an enhancement
17+
- :white_check_mark: Create a PR:
18+
- [Creating a failing test-case](https://github.com/danielgtaylor/python-betterproto/blob/master/betterproto/tests/README.md) to make bug-fixing easier
19+
- Fix any of the open issues
20+
- [Good first issues](https://github.com/danielgtaylor/python-betterproto/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
21+
- [Issues with tests](https://github.com/danielgtaylor/python-betterproto/issues?q=is%3Aissue+is%3Aopen+label%3A%22has+test%22)
22+
- New bugfix or idea
23+
- If you'd like to discuss your idea first, join us on Slack!

Makefile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@ help: ## - Show this help.
66
# Dev workflow tasks
77

88
generate: ## - Generate test cases (do this once before running test)
9-
poetry run ./betterproto/tests/generate.py
9+
poetry run python -m tests.generate
1010

1111
test: ## - Run tests
1212
poetry run pytest --cov betterproto
1313

1414
types: ## - Check types with mypy
15-
poetry run mypy betterproto --ignore-missing-imports
15+
poetry run mypy src/betterproto --ignore-missing-imports
1616

1717
format: ## - Apply black formatting to source code
1818
poetry run black . --exclude tests/output_
@@ -23,15 +23,16 @@ clean: ## - Clean out generated files from the workspace
2323
.pytest_cache \
2424
dist \
2525
**/__pycache__ \
26-
betterproto/tests/output_*
26+
tests/output_* \
27+
**/*.egg-info
2728

2829
# Manual testing
2930

3031
# By default write plugin output to a directory called output
3132
o=output
3233
plugin: ## - Execute the protoc plugin, with output write to `output` or the value passed to `-o`
3334
mkdir -p $(o)
34-
protoc --plugin=protoc-gen-custom=betterproto/plugin.py $(i) --custom_out=$(o)
35+
poetry run python -m grpc.tools.protoc $(i) --python_betterproto_out=$(o)
3536

3637
# CI tasks
3738

README.md

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ This project exists because I am unhappy with the state of the official Google p
4040

4141
This project is a reimplementation from the ground up focused on idiomatic modern Python to help fix some of the above. While it may not be a 1:1 drop-in replacement due to changed method names and call patterns, the wire format is identical.
4242

43-
## Installation & Getting Started
43+
## Installation
4444

4545
First, install the package. Note that the `[compiler]` feature flag tells it to install extra dependencies only needed by the `protoc` plugin:
4646

@@ -52,6 +52,12 @@ pip install "betterproto[compiler]"
5252
pip install betterproto
5353
```
5454

55+
*Betterproto* is under active development. To install the latest beta version, use `pip install --pre betterproto`.
56+
57+
## Getting Started
58+
59+
### Compiling proto files
60+
5561
Now, given you installed the compiler and have a proto file, e.g `example.proto`:
5662

5763
```protobuf
@@ -149,7 +155,7 @@ service Echo {
149155

150156
You can use it like so (enable async in the interactive shell first):
151157

152-
```py
158+
```python
153159
>>> import echo
154160
>>> from grpclib.client import Channel
155161

@@ -174,8 +180,8 @@ Both serializing and parsing are supported to/from JSON and Python dictionaries
174180

175181
For compatibility the default is to convert field names to `camelCase`. You can control this behavior by passing a casing value, e.g:
176182

177-
```py
178-
>>> MyMessage().to_dict(casing=betterproto.Casing.SNAKE)
183+
```python
184+
MyMessage().to_dict(casing=betterproto.Casing.SNAKE)
179185
```
180186

181187
### Determining if a message was sent
@@ -298,9 +304,22 @@ datetime.datetime(2019, 1, 1, 11, 59, 58, 800000, tzinfo=datetime.timezone.utc)
298304

299305
## Development
300306

301-
Join us on [Slack](https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ)!
307+
- _Join us on [Slack](https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ)!_
308+
- _See how you can help → [Contributing](CONTRIBUTING.md)_
309+
310+
### Requirements
311+
312+
- Python (3.6 or higher)
313+
314+
- [poetry](https://python-poetry.org/docs/#installation)
315+
*Needed to install dependencies in a virtual environment*
316+
317+
- make ([ubuntu](https://www.howtoinstall.me/ubuntu/18-04/make/), [windows](https://stackoverflow.com/questions/32127524/how-to-install-and-use-make-in-windows), [mac](https://osxdaily.com/2014/02/12/install-command-line-tools-mac-os-x/))
318+
319+
*Needed to conveniently run development tasks.*
320+
*Alternatively, manually run the commands defined in the [Makefile](./Makefile)*
302321

303-
First, make sure you have Python 3.6+ and `poetry` installed, along with the official [Protobuf Compiler](https://github.com/protocolbuffers/protobuf/releases) for your platform. Then:
322+
### Setup
304323

305324
```sh
306325
# Get set up with the virtual env & dependencies
@@ -310,7 +329,7 @@ poetry install
310329
poetry shell
311330
```
312331

313-
To benefit from the collection of standard development tasks ensure you have make installed and run `make help` to see available tasks.
332+
Run `make help` to see all available development tasks.
314333

315334
### Code style
316335

@@ -413,10 +432,10 @@ protoc \
413432
- [x] Enum strings
414433
- [x] Well known types support (timestamp, duration, wrappers)
415434
- [x] Support different casing (orig vs. camel vs. others?)
416-
- [ ] Async service stubs
435+
- [x] Async service stubs
417436
- [x] Unary-unary
418437
- [x] Server streaming response
419-
- [ ] Client streaming request
438+
- [x] Client streaming request
420439
- [x] Renaming messages and fields to conform to Python name standards
421440
- [x] Renaming clashes with language keywords
422441
- [x] Python package

0 commit comments

Comments
 (0)