-
Notifications
You must be signed in to change notification settings - Fork 145
Add generated protos #42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1b0fdc2
f3f6962
75d0e48
21b4f2d
8dad0fe
245cb8a
5c0c4c1
d7d69f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -68,13 +68,22 @@ def fix_generated_output(base_path: Path): | |
| f.write(content) | ||
| # Write init | ||
| with (base_path / "__init__.py").open("w") as f: | ||
| # Add docstring to API's init | ||
| if str(base_path.as_posix()).endswith("/temporal/api"): | ||
| f.write('"""gRPC API."""\n') | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why?
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because we fail my |
||
| # Imports | ||
| message_names = [] | ||
| for stem, messages in imports.items(): | ||
| for message in messages: | ||
| f.write(f"from .{stem} import {message}\n") | ||
| # MyPy protobuf does not document this experimental class, see | ||
| # https://github.com/nipunn1313/mypy-protobuf/issues/212#issuecomment-885300106 | ||
| import_suffix = "" | ||
| if stem == "service_pb2_grpc" and message == "WorkflowService": | ||
| import_suffix = " # type: ignore" | ||
| f.write(f"from .{stem} import {message}{import_suffix}\n") | ||
| message_names.append(message) | ||
| # __all__ | ||
| message_names = sorted(message_names) | ||
| if message_names: | ||
| f.write( | ||
| f'\n__all__ = [\n "' + '",\n "'.join(message_names) + '",\n]\n' | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| from .message_pb2 import ( | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Every file starting here is auto-generated |
||
| CancelTimerCommandAttributes, | ||
| CancelWorkflowExecutionCommandAttributes, | ||
| Command, | ||
| CompleteWorkflowExecutionCommandAttributes, | ||
| ContinueAsNewWorkflowExecutionCommandAttributes, | ||
| FailWorkflowExecutionCommandAttributes, | ||
| RecordMarkerCommandAttributes, | ||
| RequestCancelActivityTaskCommandAttributes, | ||
| RequestCancelExternalWorkflowExecutionCommandAttributes, | ||
| ScheduleActivityTaskCommandAttributes, | ||
| SignalExternalWorkflowExecutionCommandAttributes, | ||
| StartChildWorkflowExecutionCommandAttributes, | ||
| StartTimerCommandAttributes, | ||
| UpsertWorkflowSearchAttributesCommandAttributes, | ||
| ) | ||
|
|
||
| __all__ = [ | ||
| "CancelTimerCommandAttributes", | ||
| "CancelWorkflowExecutionCommandAttributes", | ||
| "Command", | ||
| "CompleteWorkflowExecutionCommandAttributes", | ||
| "ContinueAsNewWorkflowExecutionCommandAttributes", | ||
| "FailWorkflowExecutionCommandAttributes", | ||
| "RecordMarkerCommandAttributes", | ||
| "RequestCancelActivityTaskCommandAttributes", | ||
| "RequestCancelExternalWorkflowExecutionCommandAttributes", | ||
| "ScheduleActivityTaskCommandAttributes", | ||
| "SignalExternalWorkflowExecutionCommandAttributes", | ||
| "StartChildWorkflowExecutionCommandAttributes", | ||
| "StartTimerCommandAttributes", | ||
| "UpsertWorkflowSearchAttributesCommandAttributes", | ||
| ] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did this in TS and TBH it's probably better to just have a separate build for docs and proto check to avoid delaying the entire pipeline.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it's fast enough, and it's on the fastest target so still gets done before mac/windows. Proto gen is quite fast.