Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
grpclib: pure-Python gRPC implementation
Search
Sponsored
·
Your Podcast. Everywhere. Effortlessly.
Share. Educate. Inspire. Entertain. You do you. We'll handle the rest.
→
Vladimir Magamedov
April 28, 2018
Programming
530
0
Share
grpclib: pure-Python gRPC implementation
Vladimir Magamedov
April 28, 2018
More Decks by Vladimir Magamedov
See All by Vladimir Magamedov
Microservices
vmagamedov
0
45
Microservices / gRPC
vmagamedov
1
430
High Performance SQLAlchemy
vmagamedov
5
890
Other Decks in Programming
See All in Programming
飯MCP
yusukebe
0
440
「速くなった気がする」をデータで疑う
senleaf24
0
110
Codex CLIのSubagentsによる並列API実装 / Parallel API Implementation with Codex CLI Subagents
takatty
2
730
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
180
条件判定に名前、つけてますか? #phperkaigi #c
77web
2
890
モックわからないマン卒業記 ~振る舞いを起点に見直した、フロントエンドテストにおけるモックの使いどころ~
tasukuwatanabe
3
430
夢の無限スパゲッティ製造機 -実装篇- #phpstudy
o0h
PRO
0
180
AI時代の脳疲弊と向き合う ~言語学としてのPHP~
sakuraikotone
1
1.7k
20260315 AWSなんもわからん🥲
chiilog
2
180
AI 開発合宿を通して得た学び
niftycorp
PRO
0
180
ネイティブアプリとWebフロントエンドのAPI通信ラッパーにおける共通化の勘所
suguruooki
0
230
Xdebug と IDE による デバッグ実行の仕組みを見る / Exploring-How-Debugging-Works-with-Xdebug-and-an-IDE
shin1x1
0
270
Featured
See All Featured
Neural Spatial Audio Processing for Sound Field Analysis and Control
skoyamalab
0
240
Into the Great Unknown - MozCon
thekraken
40
2.3k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
270
Faster Mobile Websites
deanohume
310
31k
Tell your own story through comics
letsgokoyo
1
880
Practical Orchestrator
shlominoach
191
11k
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
21
1.4k
The Spectacular Lies of Maps
axbom
PRO
1
660
Ecommerce SEO: The Keys for Success Now & Beyond - #SERPConf2024
aleyda
1
1.9k
10 Git Anti Patterns You Should be Aware of
lemiorhan
PRO
659
61k
Java REST API Framework Comparison - PWX 2021
mraible
34
9.2k
Transcript
grpclib @vmagamedov, Evo
HTTP/2 protocol • Binary • Multiplexing • Bidirectional streams •
Flow control • Headers compression
gRPC protocol = HTTP/2 + • Deadlines • Cancellation •
Metadata (extensibility) • Declarative service definition language (.proto files) • Binary messages encoding (protobuf by default) • Streaming requests and responses • Authentication, Introspection, Load balancing x2
gRPC request: HEADERS :method = POST :scheme = http :path
= /cafe.CoffeeMachine/MakeLatte :authority = cafe.svc:50051 content-type = application/grpc+proto te = trailers DATA ... length-prefixed message(s) ... DATA
gRPC response: HEADERS :status = 200 content-type = application/grpc+proto DATA
... length-prefixed message(s) ... DATA HEADERS # trailers grpc-status = 0 # OK
• grpcio by Google • Python 2.7, >=3.4 • threads
• C++ based core: server and client • grpclib by Me & contributors • Python >= 3.5 • async/await • pure-Python, based on awesome hyper-h2 project
Definition syntax = "proto3"; package helloworld; service Greeter { rpc
SayHello (HelloRequest) returns (HelloReply) {} } message HelloRequest { string name = 1; } message HelloReply { string message = 1; }
class Greeter(GreeterBase): async def SayHello(self, stream): request = await stream.recv_message()
message = 'Hello, {}!'.format(request.name) await stream.send_message(HelloReply(message=message)) server = Server([Greeter()], loop=loop) loop.run_until_complete(server.start('127.0.0.1', 50051)) Server
channel = Channel('greeter.svc', 50051, loop=loop) stub = GreeterStub(channel) async def
make_request(): response = await stub.SayHello(HelloRequest(name='World')) assert response.message == 'Hello, World!' Client
None
pip3 install grpclib Have fun! Come work with us (Evo)
;-)