Skip to content

Commit 7013b21

Browse files
Release 0.1.20 (#97)
- Fix the bug that can occur when a reflection server doesn't serve a dependency - Fix tests to allow for testing and usage of Protobuf 5 - Add nox to the testing tool for local testing of multiple Python and protobuf verisons - Update documentation to reflect support plans - Clean up action flows for testing
1 parent f96534c commit 7013b21

21 files changed

+237
-120
lines changed

.github/workflows/test.yaml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,30 @@ on:
77
- master
88

99
jobs:
10+
run_checks:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
- name: Set up Python 3.8
15+
uses: actions/setup-python@v5
16+
with:
17+
python-version: 3.8
18+
- name: Install dependencies
19+
run: |
20+
pip install -r requirements-lint.txt
21+
- name: Lint and check formatting with ruff
22+
run: |
23+
ruff check src/ --statistics --config ruff.toml
24+
ruff format src/ --check --config ruff.toml
25+
- name: Typecheck with mypy
26+
run: |
27+
mypy src/grpc_requests/*.py
1028
run_tests:
1129
runs-on: ubuntu-latest
1230
strategy:
1331
matrix:
14-
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]
32+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
33+
protobuf-version: ["4.25.4", "5.27.3"]
1534
steps:
1635
- uses: actions/checkout@v4
1736
- name: Set up Python ${{ matrix.python-version }}
@@ -21,15 +40,9 @@ jobs:
2140
- name: Install dependencies
2241
run: |
2342
python -m pip install --upgrade pip
24-
pip install -r requirements-dev.txt
2543
pip install -e .
26-
- name: Lint and check formatting with ruff
27-
run: |
28-
ruff check src/grpc_requests/*.py src/tests/*.py --statistics --config ruff.toml
29-
ruff format src/grpc_requests/*.py src/tests/*.py --check --config ruff.toml
30-
- name: Typecheck with mypy
31-
run: |
32-
mypy src/grpc_requests/*.py
44+
pip install -r requirements-test.txt
45+
pip install protobuf==${{ matrix.protobuf-version }}
3346
- name: Test with pytest
3447
run: |
3548
pytest --cov-report=xml --cov=src/grpc_requests

CHANGELOG.md

Lines changed: 41 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,48 +5,72 @@ 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+
## [0.1.20](https://github.com/grpc-requests/grpc_requests/releases/tag/v0.1.20) - 2024-08-15
9+
10+
### Added
11+
12+
- Noxfile for testing combinations of supported versions Python and protobuf
13+
- Specifications around support targets for Python and protobuf for the library
14+
15+
### Fixed
16+
17+
- Fixed a bug wherein attempting to retrieve a dependency of a FileDescriptor could
18+
result thrown an exception if the dependency was not being served via reflection by
19+
the server.
20+
21+
## [0.1.19](https://github.com/grpc-requests/grpc_requests/releases/tag/v0.1.19) - 2024-07-18
22+
23+
### Added
24+
25+
- Tools for developers to measure complexity of the code base
26+
- Integrations with mypy
27+
28+
### Removed
29+
30+
Support for Python 3.7
31+
832
## [0.1.18](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.18) - 2024-05-18
933

10-
## Added
34+
### Added
1135

1236
- Support for lazy loading of services in async clients
1337

1438
## [0.1.17](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.17) - 2024-04-22
1539

16-
## Added
40+
### Added
1741

1842
- Support for custom message parsing in both async and sync clients
1943

20-
## Removed
44+
### Removed
2145

2246
- Removed singular FileDescriptor getter methods and Method specific field descriptor
2347
methods as laid out previously.
2448

2549
## [0.1.16](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.16) - 2024-03-03
2650

27-
## Added
51+
### Added
2852

2953
- Additional usage examples
3054

31-
## Fixed
55+
### Fixed
3256

3357
- Put deprecation warnings in the correct place for old get_descriptor methods, so they do not warn at all times.
3458

3559
## [0.1.15](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.15) - 2024-02-17
3660

37-
## Added
61+
### Added
3862

3963
- Add methods to return FileDescriptors and their transistive dependencies as requested by either a name or symbol
4064
- Add option to skip automatic checking of method availability
4165

42-
## Deprecated
66+
### Deprecated
4367

4468
- Due to the possibility of transient dependencies being missed, or other name or symbol collisions, methods to access singular FileDescriptors are deprecated and will be removed in version 0.1.17
4569
- The method to retrieve fields of a method's descriptor input type alone will be removed in version 0.1.17
4670

4771
## [0.1.14](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.14) - 2024-01-06
4872

49-
## Added
73+
### Added
5074

5175
- MethodMetaData accessible to clients
5276
- MethodDescriptors accessible via MethodMetaData
@@ -55,49 +79,47 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5579

5680
## [0.1.13](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.13) - 2023-12-03
5781

58-
## Added
82+
### Added
5983

6084
- Added channel interceptors for standard and async clients
6185

62-
## Fixed
86+
### Fixed
6387

6488
- Refactored how methods and services are added to description pool to better avoid cases where FileDescriptors may be added twice.
6589

6690
## [0.1.12](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.12) - 2023-11-26
6791

68-
## Added
92+
### Added
6993

7094
- Method to print out a generic descriptor added to utils collection
7195
- Helper methods to print out a method's request and responses in a human readable format
7296

73-
## Changed
97+
### Changed
7498

7599
- Documentation revamped
76100
- Version checks to avoid using deprecated methods added to async client
77101

78-
## Fixed
102+
### Fixed
79103

80104
- Include `requirements.txt` in build manifest
81105

82-
## Deprecated
106+
### Deprecated
83107

84108
- Method to retrieve fields for the descriptor of a method's input type.
85109

86-
## Added
87-
88110
## [0.1.11](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.11) - 2023-10-05
89111

90-
## Added
112+
### Added
91113

92114
- Method to retrieve fields for the descriptor of a method's input type.
93115

94-
## Changes
116+
### Changes
95117

96118
- Updates to minimum versons of requirements to address vulnerabilities
97119

98120
## [0.1.10](https://github.com/wesky93/grpc_requests/releases/tag/v0.1.10) - 2023-03-07
99121

100-
## Fixed
122+
### Fixed
101123

102124
- Corrected pin of `protobuf` version in `requirements.txt`
103125

README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# grpc_requests
22

3+
[![Nox](https://img.shields.io/badge/%F0%9F%A6%8A-Nox-D85E00.svg)](https://github.com/wntrblm/nox)
34
[![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
45
[![Checked with mypy](https://www.mypy-lang.org/static/mypy_badge.svg)](https://mypy-lang.org/)
56
[![PyPI](https://img.shields.io/pypi/v/grpc-requests?style=flat-square)](https://pypi.org/project/grpc-requests)
@@ -19,7 +20,7 @@ from grpc_requests import Client
1920
client = Client.get_by_endpoint("localhost:50051")
2021
assert client.service_names == ["helloworld.Greeter"]
2122

22-
request_data = {"name": "sinsky"}
23+
request_data = {"name": "sinsky"}
2324
say_hello_response = client.request("helloworld.Greeter", "SayHello", request_data)
2425
assert say_hello_response == {"message":"Hello sinsky!"}
2526
```
@@ -60,15 +61,28 @@ usage scenarioes, and the [unit tests](./src/tests/) are also a useful reference
6061

6162
Contributions from the community are welcomed and greatly appreciated.
6263

63-
Before opening a PR, [tests.sh](./tests.sh) can be used to ensure the contribution passes
64-
linting and unit test checks. You can also run [complexity.sh](./complexity.sh) to use
64+
Before opening a PR, running `python -m nox` can be used to ensure the contribution passes
65+
linting and unit test checks for all supported versions of Python and protobuf.
66+
You can also run [complexity.sh](./complexity.sh) to use
6567
[radon](https://pypi.org/project/radon/) to look at the cyclomatic complexity,
6668
maintainability index, and Halstead effort and difficulty of files.
6769

6870
PRs should be targeted to merge with the `develop` branch. When opening a PR,
6971
please assign it to a maintainer for review. The maintainers will take it from
7072
there.
7173

74+
## Compatibility
75+
76+
`grpc_requests` currently does its best to support versions of Python and
77+
protobuf that are within their support lifetimes. You may find that other versions
78+
of dependencies work with the library, but this should be treated as a happy accident.
79+
80+
For Python, we target versions that are in the security and bugfix phases.
81+
For protobuf, we target versions that in their public support phase.
82+
83+
[Python's support matrix](https://devguide.python.org/versions/)
84+
[Protobuf's support matrix](https://protobuf.dev/support/version-support/#python)
85+
7286
## Questions, Comments, Issues?
7387

7488
For questions, please start a conversation on the [discussions page](https://github.com/wesky93/grpc_requests/discussions)!

noxfile.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import nox
2+
3+
@nox.session
4+
@nox.parametrize(
5+
"python,protobuf",
6+
[
7+
(python, protobuf)
8+
for python in ["3.8","3.9","3.10","3.11","3.12"]
9+
for protobuf in ["4.25.4","5.27.3"]
10+
]
11+
)
12+
def test(session, protobuf):
13+
session.install("-e",".")
14+
session.install("-r", "requirements-test.txt")
15+
session.install(f"protobuf=={protobuf}")
16+
session.run("pytest")
17+
18+
@nox.session
19+
def lint(session):
20+
session.install("-r", "requirements-lint.txt")
21+
session.run("ruff", "check", "src/", "--statistics", "--config", "ruff.toml")
22+
session.run("ruff", "format", "src/", "--config", "ruff.toml")
23+
session.run("mypy", "src/grpc_requests/")

requirements-dev.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ grpcio-tools>=1.60.1
1212
grpc-stubs >= 1.53.0
1313
types-protobuf>=5.26.0
1414
radon>=6.0.1
15-
mypy>=1.10.0
15+
mypy>=1.10.0
16+
nox>=2024.4.15

requirements-lint.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
grpc-stubs >= 1.53.0
2+
mypy>=1.10.0
3+
ruff>=0.1.7
4+
types-protobuf>=5.26.0

requirements-test.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
grpcio >= 1.60.1
2+
grpcio-reflection >= 1.60.1
3+
google-api-core>=2.11.1
4+
cryptography>=41.0.7
5+
pytest-cov>=4.0.0
6+
pytest-asyncio>=0.15.1
7+
aiounittest>=1.4.2
8+
grpc-interceptor>=0.15.4

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
grpcio >= 1.60.1
22
grpcio-reflection >= 1.60.1
3-
protobuf>=3.20.3,<5.0.0dev
3+
protobuf>=3.20.3
44
google-api-core>=2.11.1
5-
cryptography>=41.0.7
5+
cryptography>=41.0.7

ruff.toml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
1-
# Continue supporting python 3.7
2-
target-version = "py37"
1+
target-version = "py38"
2+
3+
# Exclude compiled Protobuf files
4+
exclude = ["**/*_pb2.py", "**/*_pb2_grpc.py", "**/*_pb2.pyi", "**/*_pb2_grpc.pyi"]
5+
36

47
[lint]
58
# Bugbear Rules
@@ -14,6 +17,3 @@ unfixable = ["B"]
1417
[lint.per-file-ignores]
1518
"__init__.py" = ["E402"]
1619
"**/{tests,docs,tools}/*" = ["E402"]
17-
18-
19-

src/examples/client_tester_client.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,41 +9,41 @@
99
running.
1010
"""
1111

12-
host = 'localhost'
13-
port = '50051'
12+
host = "localhost"
13+
port = "50051"
1414
endpoint = f"{host}:{port}"
1515

1616
client = Client.get_by_endpoint(endpoint)
1717

18-
service = 'client_tester.ClientTester'
18+
service = "client_tester.ClientTester"
1919

2020
# Unary-Unary Example
2121

22-
unary_unary_method = 'TestUnaryUnary'
22+
unary_unary_method = "TestUnaryUnary"
2323
unary_unary_request = {}
2424

2525
response = client.unary_unary(service, unary_unary_method, unary_unary_request)
2626
print(response)
2727

2828
# Unary-Stream Example
2929

30-
unary_stream_method = 'TestUnaryStream'
30+
unary_stream_method = "TestUnaryStream"
3131
unary_stream_request = {}
3232

3333
responses = client.unary_stream(service, unary_stream_method, unary_stream_request)
3434
print(responses)
3535

3636
# Stream-Unary Example
3737

38-
stream_unary_method = 'TestStreamUnary'
38+
stream_unary_method = "TestStreamUnary"
3939
stream_unary_request = [{}, {}, {}]
4040

4141
response = client.stream_unary(service, stream_unary_method, stream_unary_request)
4242
print(response)
4343

4444
# Stream-Stream Example
4545

46-
stream_stream_method = 'TestStreamStream'
46+
stream_stream_method = "TestStreamStream"
4747
stream_stream_request = [{}, {}, {}]
4848

4949
responses = client.stream_stream(service, stream_stream_method, stream_stream_request)

0 commit comments

Comments
 (0)