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
Vladimir Magamedov
April 28, 2018
Programming
0
520
grpclib: pure-Python gRPC implementation
Vladimir Magamedov
April 28, 2018
Tweet
Share
More Decks by Vladimir Magamedov
See All by Vladimir Magamedov
Microservices
vmagamedov
0
44
Microservices / gRPC
vmagamedov
1
420
High Performance SQLAlchemy
vmagamedov
5
890
Other Decks in Programming
See All in Programming
Apache Iceberg V3 and migration to V3
tomtanaka
0
150
[KNOTS 2026登壇資料]AIで拡張‧交差する プロダクト開発のプロセス および携わるメンバーの役割
hisatake
0
250
なるべく楽してバックエンドに型をつけたい!(楽とは言ってない)
hibiki_cube
0
140
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
4
310
開発者から情シスまで - 多様なユーザー層に届けるAPI提供戦略 / Postman API Night Okinawa 2026 Winter
tasshi
0
200
Oxlintはいいぞ
yug1224
5
1.3k
コントリビューターによるDenoのすゝめ / Deno Recommendations by a Contributor
petamoriken
0
200
CSC307 Lecture 02
javiergs
PRO
1
770
Architectural Extensions
denyspoltorak
0
270
LLM Observabilityによる 対話型音声AIアプリケーションの安定運用
gekko0114
2
420
【卒業研究】会話ログ分析によるユーザーごとの関心に応じた話題提案手法
momok47
0
190
Basic Architectures
denyspoltorak
0
660
Featured
See All Featured
HU Berlin: Industrial-Strength Natural Language Processing with spaCy and Prodigy
inesmontani
PRO
0
200
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
PRO
196
71k
Technical Leadership for Architectural Decision Making
baasie
1
240
Paper Plane (Part 1)
katiecoart
PRO
0
4k
Google's AI Overviews - The New Search
badams
0
900
Darren the Foodie - Storyboard
khoart
PRO
2
2.3k
Put a Button on it: Removing Barriers to Going Fast.
kastner
60
4.2k
Leveraging Curiosity to Care for An Aging Population
cassininazir
1
160
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
580
svc-hook: hooking system calls on ARM64 by binary rewriting
retrage
1
97
Everyday Curiosity
cassininazir
0
130
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
37
6.3k
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)
;-)