Skip to content

Rework grpc locations and add some different structure #2

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

Closed
wants to merge 6 commits into from

Conversation

cretz
Copy link
Member

@cretz cretz commented Jan 27, 2022

What was changed

  • temporalio/proto/temporal/api -> temporalio/api
  • temporalio/proto/dependencies -> temporalio/api/dependencies
  • temporalio/proto/temporal/sdk -> temporalio/bridge/proto
  • Add aliases for all protos/grpc to top-level of respective module for clarity
  • Add LICENSE
  • Add simple pure-python gRPC test
  • Add isort to format/lint task
  • Add mypy lint check and mypy-protobuf support
  • Add pytest task

@cretz cretz requested review from bergundy and Sushisource January 27, 2022 21:37
@cretz cretz marked this pull request as draft January 27, 2022 21:38
@@ -0,0 +1,54 @@
import logging
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can test just the protos since as I mentioned before we don't need to generate the grpc output.

Copy link
Member Author

@cretz cretz Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's reasonable not only to confirm the pure Python client works, but to show even what using a pure python gRPC client looks like. Not committing protos makes discovery horrible for code/repo readers.

@cretz cretz marked this pull request as ready for review January 27, 2022 23:15
@@ -0,0 +1 @@
from .core_interface_pb2 import ActivityHeartbeat, ActivityTaskCompletion
Copy link
Member Author

@cretz cretz Jan 27, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the auto-generated code, but I think it still deserves to be checked in to keep the dir here. But if there's disagreement, I can remove this and add .gitkeep to this dir instead (or just mkdir it during build).

- Install the package dependencies

```bash
poetry install
```

- Build the project (only generate the protos for now)
- Build the project

```bash
poe build
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a poetry build command, I think we could integrate with that.
Not blocking this PR.

grpcio = "^1.43.0"
python = "^3.7"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to restrict to python<3.10?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not 3.10? I use 3.10 successfully on Windows.

Comment on lines +65 to +68
with (base_path / "__init__.py").open("w") as f:
for stem, messages in imports.items():
for message in messages:
f.write(f"from .{stem} import {message}\n")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a nice addition!

Comment on lines +53 to +55
content = fix_api_import(content)
content = fix_dependency_import(content)
content = fix_sdk_import(content)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: you can use a single re.sub call with a callback https://docs.python.org/3/library/re.html#re.sub
Not blocking the PR of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants