Skip to content
This repository was archived by the owner on Sep 21, 2023. It is now read-only.

Commit 03332a4

Browse files
fix: remove gRPC send/recv limits (#18)
1 parent 4055ec4 commit 03332a4

File tree

11 files changed

+67
-19
lines changed

11 files changed

+67
-19
lines changed

.flake8

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ exclude =
2626
*_pb2.py
2727

2828
# Standard linting exemptions.
29+
**/.nox/**
2930
__pycache__,
3031
.git,
3132
*.pyc,

.pre-commit-config.yaml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# See https://pre-commit.com for more information
2+
# See https://pre-commit.com/hooks.html for more hooks
3+
repos:
4+
- repo: https://github.com/pre-commit/pre-commit-hooks
5+
rev: v3.4.0
6+
hooks:
7+
- id: trailing-whitespace
8+
- id: end-of-file-fixer
9+
- id: check-yaml
10+
- repo: https://github.com/psf/black
11+
rev: 19.10b0
12+
hooks:
13+
- id: black
14+
- repo: https://gitlab.com/pycqa/flake8
15+
rev: 3.8.4
16+
hooks:
17+
- id: flake8

CONTRIBUTING.rst

+15-6
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ In order to add a feature:
2121
- The feature must be documented in both the API and narrative
2222
documentation.
2323

24-
- The feature must work fully on the following CPython versions: 2.7,
25-
3.5, 3.6, 3.7 and 3.8 on both UNIX and Windows.
24+
- The feature must work fully on the following CPython versions:
25+
3.6, 3.7, 3.8 and 3.9 on both UNIX and Windows.
2626

2727
- The feature must not add unnecessary dependencies (where
2828
"unnecessary" is of course subjective, but new dependencies should
@@ -111,6 +111,16 @@ Coding Style
111111
should point to the official ``googleapis`` checkout and the
112112
the branch should be the main branch on that remote (``master``).
113113

114+
- This repository contains configuration for the
115+
`pre-commit <https://pre-commit.com/>`__ tool, which automates checking
116+
our linters during a commit. If you have it installed on your ``$PATH``,
117+
you can enable enforcing those checks via:
118+
119+
.. code-block:: bash
120+
121+
$ pre-commit install
122+
pre-commit installed at .git/hooks/pre-commit
123+
114124
Exceptions to PEP8:
115125

116126
- Many unit tests use a helper method, ``_call_fut`` ("FUT" is short for
@@ -192,25 +202,24 @@ Supported Python Versions
192202

193203
We support:
194204

195-
- `Python 3.5`_
196205
- `Python 3.6`_
197206
- `Python 3.7`_
198207
- `Python 3.8`_
208+
- `Python 3.9`_
199209

200-
.. _Python 3.5: https://docs.python.org/3.5/
201210
.. _Python 3.6: https://docs.python.org/3.6/
202211
.. _Python 3.7: https://docs.python.org/3.7/
203212
.. _Python 3.8: https://docs.python.org/3.8/
213+
.. _Python 3.9: https://docs.python.org/3.9/
204214

205215

206216
Supported versions can be found in our ``noxfile.py`` `config`_.
207217

208218
.. _config: https://github.com/googleapis/python-video-transcoder/blob/master/noxfile.py
209219

210-
Python 2.7 support is deprecated. All code changes should maintain Python 2.7 compatibility until January 1, 2020.
211220

212221
We also explicitly decided to support Python 3 beginning with version
213-
3.5. Reasons for this include:
222+
3.6. Reasons for this include:
214223

215224
- Encouraging use of newest versions of Python 3
216225
- Taking the lead of `prominent`_ open-source `projects`_

docs/conf.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -345,10 +345,10 @@
345345

346346
# Example configuration for intersphinx: refer to the Python standard library.
347347
intersphinx_mapping = {
348-
"python": ("http://python.readthedocs.org/en/latest/", None),
349-
"google-auth": ("https://google-auth.readthedocs.io/en/stable", None),
348+
"python": ("https://python.readthedocs.org/en/latest/", None),
349+
"google-auth": ("https://googleapis.dev/python/google-auth/latest/", None),
350350
"google.api_core": ("https://googleapis.dev/python/google-api-core/latest/", None,),
351-
"grpc": ("https://grpc.io/grpc/python/", None),
351+
"grpc": ("https://grpc.github.io/grpc/python/", None),
352352
"proto-plus": ("https://proto-plus-python.readthedocs.io/en/latest/", None),
353353
}
354354

google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
_transport_registry["grpc"] = TranscoderServiceGrpcTransport
2929
_transport_registry["grpc_asyncio"] = TranscoderServiceGrpcAsyncIOTransport
3030

31-
3231
__all__ = (
3332
"TranscoderServiceTransport",
3433
"TranscoderServiceGrpcTransport",

google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc.py

+9-1
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,10 @@ def __init__(
154154
ssl_credentials=ssl_credentials,
155155
scopes=scopes or self.AUTH_SCOPES,
156156
quota_project_id=quota_project_id,
157+
options=[
158+
("grpc.max_send_message_length", -1),
159+
("grpc.max_receive_message_length", -1),
160+
],
157161
)
158162
self._ssl_channel_credentials = ssl_credentials
159163
else:
@@ -172,6 +176,10 @@ def __init__(
172176
ssl_credentials=ssl_channel_credentials,
173177
scopes=scopes or self.AUTH_SCOPES,
174178
quota_project_id=quota_project_id,
179+
options=[
180+
("grpc.max_send_message_length", -1),
181+
("grpc.max_receive_message_length", -1),
182+
],
175183
)
176184

177185
self._stubs = {} # type: Dict[str, Callable]
@@ -198,7 +206,7 @@ def create_channel(
198206
) -> grpc.Channel:
199207
"""Create and return a gRPC channel object.
200208
Args:
201-
address (Optionsl[str]): The host for the channel to use.
209+
address (Optional[str]): The host for the channel to use.
202210
credentials (Optional[~.Credentials]): The
203211
authorization credentials to attach to requests. These
204212
credentials identify this application to the service. If

google/cloud/video/transcoder_v1beta1/services/transcoder_service/transports/grpc_asyncio.py

+8
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,10 @@ def __init__(
199199
ssl_credentials=ssl_credentials,
200200
scopes=scopes or self.AUTH_SCOPES,
201201
quota_project_id=quota_project_id,
202+
options=[
203+
("grpc.max_send_message_length", -1),
204+
("grpc.max_receive_message_length", -1),
205+
],
202206
)
203207
self._ssl_channel_credentials = ssl_credentials
204208
else:
@@ -217,6 +221,10 @@ def __init__(
217221
ssl_credentials=ssl_channel_credentials,
218222
scopes=scopes or self.AUTH_SCOPES,
219223
quota_project_id=quota_project_id,
224+
options=[
225+
("grpc.max_send_message_length", -1),
226+
("grpc.max_receive_message_length", -1),
227+
],
220228
)
221229

222230
# Run the base constructor.

google/cloud/video/transcoder_v1beta1/types/__init__.py

-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@
5151
ListJobTemplatesResponse,
5252
)
5353

54-
5554
__all__ = (
5655
"Job",
5756
"JobTemplate",

noxfile.py

+3-4
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
DEFAULT_PYTHON_VERSION = "3.8"
3030
SYSTEM_TEST_PYTHON_VERSIONS = ["3.8"]
31-
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8"]
31+
UNIT_TEST_PYTHON_VERSIONS = ["3.6", "3.7", "3.8", "3.9"]
3232

3333

3434
@nox.session(python=DEFAULT_PYTHON_VERSION)
@@ -81,9 +81,8 @@ def default(session):
8181
session.run(
8282
"py.test",
8383
"--quiet",
84-
"--cov=google.cloud.transcoder",
85-
"--cov=google.cloud",
86-
"--cov=tests.unit",
84+
"--cov=google/cloud",
85+
"--cov=tests/unit",
8786
"--cov-append",
8887
"--cov-config=.coveragerc",
8988
"--cov-report=",

synth.metadata

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@
44
"git": {
55
"name": ".",
66
"remote": "[email protected]:googleapis/python-video-transcoder",
7-
"sha": "5a006f4972af69e2244ee71617d75c79212c9b97"
7+
"sha": "8c46378b15c05f30d712147e44abfbf97916ebf4"
88
}
99
},
1010
{
1111
"git": {
1212
"name": "synthtool",
1313
"remote": "https://github.com/googleapis/synthtool.git",
14-
"sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
14+
"sha": "6b026e1443948dcfc0b9e3289c85e940eb70f694"
1515
}
1616
},
1717
{
1818
"git": {
1919
"name": "synthtool",
2020
"remote": "https://github.com/googleapis/synthtool.git",
21-
"sha": "d5fc0bcf9ea9789c5b0e3154a9e3b29e5cea6116"
21+
"sha": "6b026e1443948dcfc0b9e3289c85e940eb70f694"
2222
}
2323
}
2424
],

tests/unit/gapic/transcoder_v1beta1/test_transcoder_service.py

+8
Original file line numberDiff line numberDiff line change
@@ -2642,6 +2642,10 @@ def test_transcoder_service_transport_channel_mtls_with_client_cert_source(
26422642
scopes=("https://www.googleapis.com/auth/cloud-platform",),
26432643
ssl_credentials=mock_ssl_cred,
26442644
quota_project_id=None,
2645+
options=[
2646+
("grpc.max_send_message_length", -1),
2647+
("grpc.max_receive_message_length", -1),
2648+
],
26452649
)
26462650
assert transport.grpc_channel == mock_grpc_channel
26472651
assert transport._ssl_channel_credentials == mock_ssl_cred
@@ -2683,6 +2687,10 @@ def test_transcoder_service_transport_channel_mtls_with_adc(transport_class):
26832687
scopes=("https://www.googleapis.com/auth/cloud-platform",),
26842688
ssl_credentials=mock_ssl_cred,
26852689
quota_project_id=None,
2690+
options=[
2691+
("grpc.max_send_message_length", -1),
2692+
("grpc.max_receive_message_length", -1),
2693+
],
26862694
)
26872695
assert transport.grpc_channel == mock_grpc_channel
26882696

0 commit comments

Comments
 (0)