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
500
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
42
Microservices / gRPC
vmagamedov
1
420
High Performance SQLAlchemy
vmagamedov
5
890
Other Decks in Programming
See All in Programming
Pull-Requestの内容を1クリックで動作確認可能にするワークフロー
natmark
2
510
実践Claude Code:20の失敗から学ぶAIペアプログラミング
takedatakashi
1
180
Leading Effective Engineering Teams in the AI Era
addyosmani
6
440
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
390
After go func(): Goroutines Through a Beginner’s Eye
97vaibhav
0
400
アメ車でサンノゼを走ってきたよ!
s_shimotori
0
220
The Past, Present, and Future of Enterprise Java
ivargrimstad
0
360
開発生産性を上げるための生成AI活用術
starfish719
3
1.1k
What's new in Spring Modulith?
olivergierke
1
150
ALL CODE BASE ARE BELONG TO STUDY
uzulla
25
6k
私達はmodernize packageに夢を見るか feat. go/analysis, go/ast / Go Conference 2025
kaorumuta
2
570
AI Coding Meetup #3 - 導入セッション / ai-coding-meetup-3
izumin5210
0
3.3k
Featured
See All Featured
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
52
5.6k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
333
22k
Reflections from 52 weeks, 52 projects
jeffersonlam
353
21k
Speed Design
sergeychernyshev
32
1.2k
StorybookのUI Testing Handbookを読んだ
zakiyama
31
6.2k
KATA
mclloyd
32
15k
VelocityConf: Rendering Performance Case Studies
addyosmani
332
24k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
248
1.3M
Bash Introduction
62gerente
615
210k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
140
34k
Intergalactic Javascript Robots from Outer Space
tanoku
273
27k
Writing Fast Ruby
sferik
629
62k
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)
;-)