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

Dynamic Code Patterns: Extending Your Applicati...

Dynamic Code Patterns: Extending Your Applications with Plugins by Doug Hellmann

Python makes loading code dynamically easy, allowing you to configure and extend your application by discovering and loading extensions at runtime. This presentation will discuss the techniques for dynamic code loading used in several well-known applications and weigh the pros and cons of each approach.

PyCon 2013

PyCon 2013

March 16, 2013
Tweet

More Decks by PyCon 2013

Other Decks in Programming

Transcript

  1. Dynamic Code Patterns: Extending Your Applications with Plugins Doug Hellmann

    – @doughellmann – PyCon 2013 1 Saturday, March 16, 13
  2. What is a “Plugin”? • Loaded Dynamically • Extends Core

    • Possibly Unknown Source 2 Saturday, March 16, 13
  3. Why Plugins? • Better API Abstraction • Reduce Core Dependencies

    • Strategy Pattern • Visitor Pattern • Indirect Code Contributions 3 Saturday, March 16, 13
  4. • OpenStack Metering • Measures Clouds • Varied Billing Requirements

    • Deployers Extend and Customize Ceilometer 4 Saturday, March 16, 13
  5. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  6. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  7. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  8. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  9. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  10. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  11. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  12. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  13. Ceilometer Design Compute Images Volumes Network Objects Notification Message Bus

    Event Listener Compute Pollsters Central Pollsters Collector Meter Data Message Bus 5 Saturday, March 16, 13
  14. Ceilometer Plugins • Message Bus • Receiving Notifications • Polling

    Compute • Polling Other • Storage 6 Saturday, March 16, 13
  15. Research • Blogofile • Sphinx • Mercurial • cliff •

    virtualenvwrapper • Nose • Trac • Django • Pyramid • SQLAlchemy • Diamond • Nova 7 Saturday, March 16, 13
  16. Discovery Explicit Scan File Import Reference Mercurial Diamond Blogofile Mercurial

    Django Pyramid Sphinx Nova Trac Nose cliff virtualenvwrapper 8 Saturday, March 16, 13
  17. Importing Custom pkg_resources Django Pyramid Sphinx Diamond Nova Nose SQLAlchemy

    Blogofile Trac Nose SQLAlchemy Blogofile cliff virtualenvwrapper 10 Saturday, March 16, 13
  18. Integration Fine Coarse Prompt Inspect Nose virtualenvwrapper Sphinx Trac cliff

    Diamond Mercurial Blogofile Pyramid Django 11 Saturday, March 16, 13
  19. Integration Fine Coarse Prompt Inspect Nose virtualenvwrapper Sphinx Trac cliff

    Diamond Mercurial Blogofile Pyramid Django 12 Saturday, March 16, 13
  20. API Enforcement Convention Base Class / Interface Blogofile Mercurial Django

    Sphinx Pyramid virtualenvwrapper Nose (optional) Trac (interface) Diamond cliff (abc) 13 Saturday, March 16, 13
  21. Invocation Driver Dispatcher Iterator SQLAlchemy Nova Mercurial Django Pyramid cliff

    Nose Diamond virtualenvwrapper 14 Saturday, March 16, 13
  22. Invocation • Storage – Driver • Notifications – Dispatcher •

    Pollsters – Iterator 19 Saturday, March 16, 13
  23. Dynamic Code Patterns: Extending Your Applications with Plugins Doug Hellmann

    – @doughellmann – PyCon 2013 http://packages.python.org/distribute/pkg_resources.html https://github.com/dreamhost/stevedore https://launchpad.net/ceilometer http://doughellmann.com 25 Saturday, March 16, 13