Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Cory Benfield - Building Protocol Libraries The...

Cory Benfield - Building Protocol Libraries The Right Way

One of the great strengths of the Python ecosystem is the enormous collection of powerful, flexible libraries. However, these libraries tend to suffer from one extremely common design flaw that mean that the work done is not easily re-usable or transferable. In this talk, we talk about how to build libraries that can be used as widely as possible, through the lens of the Python Hyper HTTP project.

https://us.pycon.org/2016/schedule/presentation/1743/

PyCon 2016

May 29, 2016
Tweet

More Decks by PyCon 2016

Other Decks in Programming

Transcript

  1. Hi!

  2. Python HTTP • Hyper • h2, hpack, priority, etc. •

    Requests + urllib3 • PyCA (PyOpenSSL)
  3. I/O

  4. • httplib: state machine and parser mixed with I/O •

    aiohttp/Tornado/Twisted: state machine and parser use concurrency primitives
  5. ===================== test session starts ====================== ------- coverage: platform darwin, python

    2.7.11-final-0 ------- Name Stmts Miss Branch BrPart Cover Missing ---------------------------------------------------------------- h2/__init__.py 2 0 0 0 100% h2/connection.py 505 0 120 0 100% h2/errors.py 17 0 0 0 100% h2/events.py 107 0 4 0 100% h2/exceptions.py 41 0 0 0 100% h2/frame_buffer.py 55 0 18 0 100% h2/settings.py 79 0 26 0 100% h2/stream.py 356 0 76 0 100% h2/utilities.py 76 0 44 0 100% ---------------------------------------------------------------- TOTAL 1238 0 288 0 100% ================== 894 passed in 6.87 seconds ==================
  6. Examples • hyper-h2, a HTTP/2 protocol stack. • http://python-hyper.org/h2 •

    h11, for HTTP/1.1 • https://github.com/njsmith/h11