thempatel edited a comment on pull request #16961:
URL: https://github.com/apache/beam/pull/16961#issuecomment-1086214648
> Just to confirm, imports of the form `from
apache_beam.portability.api.beam_runner_api_pb2 import TestStreamPayload` are
no longer supported, and that's why the diff is so huge?
correct, this PR changes the the proto structure from a flat one to a
hierarchical one, like so:
```
model/
beam_fn_api.proto
beam_provision_api.proto
beam_interactive_api.proto
beam_artifact_api.proto
...
apache_beam/portability/api/
beam_fn_api_pb2.py
beam_provision_api_pb2.py
beam_interactive_api_pb2.py
beam_artifact_api_pb2.py
...
```
to
```
model/org/apache/beam/model/
beam_fn_api.proto
beam_provision_api.proto
beam_interactive_api.proto
beam_artifact_api.proto
...
apache_beam/portability/api/org/apache/beam/model/
beam_fn_api_pb2.py
beam_provision_api_pb2.py
beam_interactive_api_pb2.py
beam_artifact_api_pb2.py
...
```
so the reason you can no longer do `from
apache_beam.portability.api.beam_runner_api_pb2 import TestStreamPayload` is
because there is no module there! The fully qualified import is now
```python
from
apache_beam.portability.api.org.apache.beam.model.pipeline.beam_runner_api_pb2
import TestStreamPayload
```
In order to make this easier to work with, I updated the proto generator to
also generate module bindings in the `__init__` file of
`apache_beam.portability.api`, like so
```py
from .org.apache.beam.model import pipeline
# ...
external_transforms_pb2 = pipeline.external_transforms_pb2
# ...
```
so that you don't need to provide the fully qualified path. If we didn't do
this, this PR would be even more huge, since we'd have to update every import
of the generated bindings in the SDK
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]