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
·
SiteGround - Reliable hosting with speed, security, and support you can count on.
→
Vladimir Magamedov
April 28, 2018
Programming
0
530
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
45
Microservices / gRPC
vmagamedov
1
420
High Performance SQLAlchemy
vmagamedov
5
890
Other Decks in Programming
See All in Programming
CS教育のDX AIによる育成の効率化
niftycorp
PRO
0
120
AIコードレビューの導入・運用と AI駆動開発における「AI4QA」の取り組みについて
hagevvashi
0
490
Claude Code Skill入門
mayahoney
0
390
オブザーバビリティ駆動開発って実際どうなの?
yohfee
3
850
ベクトル検索のフィルタを用いた機械学習モデルとの統合 / python-meetup-fukuoka-06-vector-attr
monochromegane
2
440
受け入れテスト駆動開発(ATDD)×AI駆動開発 AI時代のATDDの取り組み方を考える
kztakasaki
2
580
Vuetify 3 → 4 何が変わった?差分と移行ポイント10分まとめ
koukimiura
0
140
SourceGeneratorのマーカー属性問題について
htkym
0
200
20260228_JAWS_Beginner_Kansai
takuyay0ne
5
530
Claude Codeログ基盤の構築
giginet
PRO
7
3.3k
Kubernetesでセルフホストが簡単なNewSQLを求めて / Seeking a NewSQL Database That's Simple to Self-Host on Kubernetes
nnaka2992
0
120
最初からAWS CDKで技術検証してもいいんじゃない?
akihisaikeda
4
150
Featured
See All Featured
Why You Should Never Use an ORM
jnunemaker
PRO
61
9.8k
Beyond borders and beyond the search box: How to win the global "messy middle" with AI-driven SEO
davidcarrasco
3
72
How to Build an AI Search Optimization Roadmap - Criteria and Steps to Take #SEOIRL
aleyda
1
2k
Visual Storytelling: How to be a Superhuman Communicator
reverentgeek
2
470
Reflections from 52 weeks, 52 projects
jeffersonlam
356
21k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
122
21k
The Cult of Friendly URLs
andyhume
79
6.8k
jQuery: Nuts, Bolts and Bling
dougneiner
65
8.4k
The Mindset for Success: Future Career Progression
greggifford
PRO
0
280
Evolving SEO for Evolving Search Engines
ryanjones
0
150
Git: the NoSQL Database
bkeepers
PRO
432
66k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
7.1k
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)
;-)