8000 Merge branch 'master' into remove-enum-prefix · danielgtaylor/python-betterproto@25ef492 · GitHub
[go: up one dir, main page]

Skip to content

Commit 25ef492

Browse files
authored
Merge branch 'master' into remove-enum-prefix
2 parents a2ba23e + 2bcb05a commit 25ef492

File tree

70 files changed

+5153
-1841
lines changed

Some content is hidden

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

70 files changed

+5153
-1841
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

+63Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: Bug Report
2+
description: Report broken or incorrect behaviour
3+
labels: ["bug", "investigation needed"]
4+
5+
body:
6+
- type: markdown
7+
attributes:
8+
value: >
9+
Thanks for taking the time to fill out a bug report!
10+
11+
If you're not sure it's a bug and you just have a question, the [community Slack channel](https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ) is a better place for general questions than a GitHub issue.
12+
13+
- type: input
14+
attributes:
15+
label: Summary
16+
description: A simple summary of your bug report
17+
validations:
18+
required: true
19+
20+
- type: textarea
21+
attributes:
22+
label: Reproduction Steps
23+
description: >
24+
What you did to make it happen.
25+
Ideally there should be a short code snippet in this section to help reproduce the bug.
26+
validations:
27+
required: true
28+
29+
- type: textarea
30+
attributes:
31+
label: Expected Results
32+
description: >
33+
What did you expect to happen?
34+
validations:
35+
required: true
36+
37+
- type: textarea
38+
attributes:
39+
label: Actual Results
40+
description: >
41+
What actually happened?
42+
validations:
43+
F987 required: true
44+
45+
- type: textarea
46+
attributes:
47+
label: System Information
48+
description: >
49+
Paste the result of `protoc --version; python --version; pip show betterproto` below.
50+
validations:
51+
required: true
52+
53+
- type: checkboxes
54+
attributes:
55+
label: Checklist
56+
options:
57+
- label: I have searched the issues for duplicates.
58+
required: true
59+
- label: I have shown the entire traceback, if possible.
60+
required: true
61+
- label: I have verified this issue occurs on the latest prelease of betterproto which can be installed using `pip install -U --pre betterproto`, if possible.
62+
required: true
63+

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
name:
2+
description:
3+
contact_links:
4+
- name: For questions about the library
5+
about: Support questions are better answered in our Slack group.
6+
url: https://join.slack.com/t/betterproto/shared_invite/zt-f0n0uolx-iN8gBNrkPxtKHTLpG3o1OQ
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Feature Request
2+
description: Suggest a feature for this library
3+
labels: ["enhancement"]
4+
5+
body:
6+
- type: input
7+
attributes:
8+
label: Summary
9+
description: >
10+
What problem is your f 1241 eature trying to solve? What would become easier or possible if feature was implemented?
11+
validations:
12+
required: true
13+
14+
- type: dropdown
15+
attributes:
16+
multiple: false
17+
label: What is the feature request for?
18+
options:
19+
- The core library
20+
- RPC handling
21+
- The documentation
22+
validations:
23+
required: true
24+
25+
- type: textarea
26+
attributes:
27+
label: The Problem
28+
description: >
29+
What problem is your feature trying to solve?
30+
What would become easier or possible if feature was implemented?
31+
validations:
32+
required: true
33+
34+
- type: textarea
35+
attributes:
36+
label: The Ideal Solution
37+
description: >
38+
What is your ideal solution to the problem?
39+
What would you like this feature to do?
40+
validations:
41+
required: true
42+
43+
- type: textarea
44+
attributes:
45+
label: The Current Solution
46+
description: >
47+
What is the current solution to the problem, if any?
48+
validations:
49+
required: false

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Summary
2+
3+
<!-- What is this pull request for? Does it fix any issues? -->
4+
5+
## Checklist
6+
7+
<!-- Put an x inside [ ] to check it, like so: [x] -->
8+
9+
- [ ] If code changes were made then they have been tested.
10+
- [ ] I have updated the documentation to reflect the changes.
11+
- [ ] This PR fixes an issue.
12+
- [ ] This PR adds something new (e.g. new method or parameters).
13+
- [ ] This change has an associated test.
14+
- [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
15+
- [ ] This PR is **not** a code change (e.g. documentation, README, ...)
16+

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
< 10000 /tr>
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,12 @@ jobs:
1616
fail-fast: false
1717
matrix:
1818
os: [Ubuntu, MacOS, Windows]
19-
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
20-
exclude:
21-
- os: Windows
22-
python-version: 3.6
19+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
2320
steps:
24-
- uses: actions/checkout@v2
21+
- uses: actions/checkout@v3
2522

2623
- name: Set up Python ${{ matrix.python-version }}
27-
uses: actions/setup-python@v2
24+
uses: actions/setup-python@v4
2825
with:
2926
python-version: ${{ matrix.python-version }}
3027

@@ -44,7 +41,7 @@ jobs:
4441
run: poetry config virtualenvs.in-project true
4542

4643
- name: Set up cache
47-
uses: actions/cache@v2
44+
uses: actions/cache@v3
4845
id: cache
4946
with:
5047
path: .venv

.github/workflows/code-quality.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,6 @@ jobs:
1313
name: Check code/doc formatting
1414
runs-on: ubuntu-latest
1515
steps:
16-
- uses: actions/checkout@v2
17-
- uses: actions/setup-python@v2
16+
- uses: actions/checkout@v3
17+
- uses: actions/setup-python@v4
1818
- uses: pre-commit/action@v2.0.3

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ jobs:
1515
name: Distribution
1616
runs-on: ubuntu-latest
1717
steps:
18-
- uses: actions/checkout@v2
18+
- uses: actions/checkout@v3
1919
- name: Set up Python 3.8
20-
uses: actions/setup-python@v2
20+
uses: actions/setup-python@v4
2121
with:
2222
python-version: 3.8
2323
- name: Install poetry

.pre-commit-config.yaml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,26 @@ ci:
33

44
repos:
55
- repo: https://github.com/pycqa/isort
6-
rev: 5.10.1
6+
rev: 5.11.5
77
hooks:
88
- id: isort
99

1010
- repo: https://github.com/psf/black
11-
rev: 22.3.0
11+
rev: 23.1.0
1212
hooks:
1313
- id: black
14+
args: ["--target-version", "py310"]
1415

1516
- repo: https://github.com/PyCQA/doc8
1617
rev: 0.10.1
1718
hooks:
18-
- id: doc8
19+
- id: doc8
1920
additional_dependencies:
2021
- toml
22+
23+
- repo: https://github.com/macisamuele/language-formatters-pre-commit-hooks
24+
rev: v2.10.0
25+
hooks:
26+
- id: pretty-format-java
27+
args: [--autofix, --aosp]
28+
files: ^.*\.java$

CHANGELOG.md

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,31 +7,77 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
- Versions suffixed with `b*` are in `beta` and can be installed with `pip install --pre betterproto`.
99

10-
## [Unreleased]
11-
12-
- **Breaking**: Client and Service Stubs no longer pack and unpack the input message fields as parameters.
10+
## [2.0.0b6] - 2023-06-25
11+
12+
- **Breaking**: the minimum Python version has been bumped to `3.7` [#444](https://github.com/danielgtaylor/python-betterproto/pull/444)
13+
14+
- Support generating [Pydantic dataclasses](https://docs.pydantic.dev/latest/usage/dataclasses).
15+
Pydantic dataclasses are are drop-in replacement for dataclasses in the standard library that additionally supports validation.
16+
Pass `--python_betterproto_opt=pydantic_dataclasses` to enable this feature.
17+
Refer to [#406](https://github.com/danielgtaylor/python-betterproto/pull/406)
18+
and [README.md](https://github.com/danielgtaylor/python-betterproto#generating-pydantic-models) for more information.
19+
20+
- Added support for `@generated` marker [#382](https://github.com/danielgtaylor/python-betterproto/pull/382)
21+
- Pull down the `include_default_values` argument to `to_json()` [#405](https://github.com/danielgtaylor/python-betterproto/pull/405)
22+
- Pythonize input_type name in py_input_message [#436](https://github.com/danielgtaylor/python-betterproto/pull/436)
23+
- Widen `from_dict()` to accept any `Mapping` [#451](https://github.com/danielgtaylor/python-betterproto/pull/451)
24+
- Replace `pkg_resources` with `importlib` [#462](https://github.com/danielgtaylor/python-betterproto/pull/462)
25+
26+
- Fix typechecker compatiblity checks in server streaming methods [#413](https://github.com/danielgtaylor/python-betterproto/pull/413)
27+
- Fix "empty-valued" repeated fields not being serialised [#417](https://github.com/danielgtaylor/python-betterproto/pull/417)
28+
- Fix `dict` encoding for timezone-aware `datetimes` [#468](https://github.com/danielgtaylor/python-betterproto/pull/468)
29+
- Fix `to_pydict()` serialization for optional fields [#495](https://github.com/danielgtaylor/python-betterproto/pull/495)
30+
- Handle empty value objects properly [#481](https://github.com/danielgtaylor/python-betterproto/pull/481)
31+
32+
## [2.0.0b5] - 2022-08-01
33+
34+
- **Breaking**: Client and Service Stubs no longer pack and unpack the input message fields as parameters [#331](https://github.com/danielgtaylor/python-betterproto/pull/311)
1335

1436
Update your client calls and server handlers as follows:
1537

1638
Clients before:
39+
1740
```py
1841
response = await service.echo(value="hello", extra_times=1)
1942
```
43+
2044
Clients after:
45+
2146
```py
2247
response = await service.echo(EchoRequest(value="hello", extra_times=1))
2348
```
49+
2450
Servers before:
51+
2552
```py
26-
async def echo(self, value: str, extra_times: int) -> EchoResponse:
53+
async def echo(self, value: str, extra_times: int) -> EchoResponse: ...
2754
```
55+
2856
Servers after:
57+
2958
```py
3059
async def echo(self, echo_request: EchoRequest) -> EchoResponse:
3160
# Use echo_request.value
3261
# Use echo_request.extra_times
62+
...
3363
```
3464

65+
- Add `to/from_pydict()` for `Message` [#203](https://github.com/danielgtaylor/python-betterproto/pull/203)
66+
- Format field comments also as docstrings [#304](https://github.com/danielgtaylor/python-betterproto/pull/304)
67+
- Implement `__deepcopy__` for `Message` [#339](https://github.com/danielgtaylor/python-betterproto/pull/339)
68+
- Run isort on compiled code [#355](https://github.com/danielgtaylor/python-betterproto/pull/355)
69+
- Expose timeout, deadline and metadata parameters from grpclib [#352](https://github.com/danielgtaylor/python-betterproto/pull/352)
70+
- Make `Message.__getattribute__` invisible to type checkers [#359](https://github.com/danielgtaylor/python-betterproto/pull/359)
71+
72+
- Fix map field edge-case [#254](https://github.com/danielgtaylor/python-betterproto/pull/254)
73+
- Fix message text in `NotImplementedError` [#325](https://github.com/danielgtaylor/python-betterproto/pull/325)
74+
- Fix `Message.from_dict()` in the presence of optional datetime fields [#329](https://github.com/danielgtaylor/python-betterproto/pull/329)
75+
- Support Jinja2 3.0 to prevent version conflicts [#330](https://github.com/danielgtaylor/python-betterproto/pull/330)
76+
- Fix overwriting top level `__init__.py` [#337](https://github.com/danielgtaylor/python-betterproto/pull/337)
77+
- Remove deprecation warnings when fields are initialised with non-default values [#348](https://github.com/danielgtaylor/python-betterproto/pull/348)
78+
- Ensure nested class names are converted to PascalCase [#353](https://github.com/danielgtaylor/python-betterproto/pull/353)
79+
- Fix `Message.to_dict()` mutating the underlying Message [#378](https://github.com/danielgtaylor/python-betterproto/pull/378)
80+
- Fix some parameters being missing from services [#381](https://github.com/danielgtaylor/python-betterproto/pull/381)
3581

3682
## [2.0.0b4] - 2022-01-03
3783

LICENSE.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2023 Daniel G. Taylor
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

0 commit comments

Comments
 (0)
0