plugin frameworks
play

Plugin frameworks About me About this talk Plugin 3 approaches to - PowerPoint PPT Presentation

Plugin frameworks noufal Introduction Plugin frameworks About me About this talk Plugin 3 approaches to designing plugin APIs frameworks Case #1 : Trac Trac Component architecture Noufal Ibrahim Writing a plugin Example


  1. Plugin frameworks noufal Introduction Plugin frameworks About me About this talk Plugin 3 approaches to designing plugin APIs frameworks Case #1 : Trac Trac Component architecture Noufal Ibrahim Writing a plugin Example noufal@nibrahim.net.in Pros/Cons Case #2 : py.test PyCon India 2010, MSRIT, Bangalore Metaprogramming Writing a plugin Example 25 September 2010 Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  2. Outline 1 Introduction Plugin frameworks About me noufal About this talk Plugin frameworks Introduction About me 2 Case #1 : Trac About this talk Plugin Trac Component architecture frameworks Case #1 : Writing a plugin Trac Example Trac Component architecture Writing a plugin Pros/Cons Example Pros/Cons 3 Case #2 : py.test Case #2 : Metaprogramming py.test Metaprogramming Writing a plugin Writing a plugin Example Example Pros/Cons Pros/Cons Case #3 : Emacs 4 Case #3 : Emacs Embedded scripting Embedded scripting language language Writing a plugin Example Writing a plugin

  3. About me Plugin frameworks noufal Introduction About me About this talk Plugin frameworks Case #1 : Freelance programmer/trainer based in Bangalore Trac Trac Component Organiser of PyCon India 2009, 2010 architecture Writing a plugin Example Pros/Cons Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  4. About this talk Plugin frameworks noufal This talk about approaches to writing plugin frameworks Introduction using examples About me About this talk Plugin 1 TRAC - The project planning/tracking tool from edgewall frameworks software. Case #1 : Trac 2 py.test - The test harness from the PyPy project. Trac Component architecture 3 Emacs - The extensible text editor from the GNU project. Writing a plugin Example Informed by my lifelong(?) experiences with Emacs and Pros/Cons my work with py.test and trac over the past two years Case #2 : py.test Inspired by a Stack Overflow discussion I had at Metaprogramming Writing a plugin Example http://bit.ly/bznQ2g Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  5. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me About this talk Plugin frameworks Case #1 : Trac Trac Component architecture Writing a plugin Example Pros/Cons Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  6. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me Used to shift the burden of writing your program to your About this talk Plugin user frameworks Case #1 : Trac Trac Component architecture Writing a plugin Example Pros/Cons Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  7. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me Used to shift the burden of writing your program to your About this talk Plugin user frameworks Case #1 : Used to defer important decisions for later so that they Trac Trac Component can be made when you know enough architecture Writing a plugin Example Pros/Cons Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  8. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me Used to shift the burden of writing your program to your About this talk Plugin user frameworks Case #1 : Used to defer important decisions for later so that they Trac Trac Component can be made when you know enough architecture Writing a plugin Example Used to write frameworks that can be used for multiple Pros/Cons tasks Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  9. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me Used to shift the burden of writing your program to your About this talk Plugin user frameworks Case #1 : Used to defer important decisions for later so that they Trac Trac Component can be made when you know enough architecture Writing a plugin Example Used to write frameworks that can be used for multiple Pros/Cons tasks Case #2 : py.test To reduce the size of the application Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  10. Plugin frameworks Plugin frameworks noufal Controlled ways to run user code inside your application Introduction About me Used to shift the burden of writing your program to your About this talk Plugin user frameworks Case #1 : Used to defer important decisions for later so that they Trac Trac Component can be made when you know enough architecture Writing a plugin Example Used to write frameworks that can be used for multiple Pros/Cons tasks Case #2 : py.test To reduce the size of the application Metaprogramming Writing a plugin Example Generally fun to do Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  11. Trac : Component architecture Plugin Designed using a Component architecture . frameworks Each component exposes “extension points” that can noufal plugged into by other components. Introduction About me About this talk Plugin frameworks Case #1 : Trac Trac Component architecture Writing a plugin Example Pros/Cons Case #2 : Components are singletons py.test Metaprogramming Simplified version of the Zope Component Architecture Writing a plugin Example Details at Pros/Cons Case #3 : http://trac.edgewall.org/wiki/TracDev/ComponentArchitecture Emacs Embedded Very popular architecture. Used in other applications like scripting language Eclipse. Writing a plugin Example

  12. Trac : Writing a plugin Plugin frameworks noufal Introduction About me About this talk Write a new component (subclass component ). Plugin frameworks Interfaces are created by subclassing Interface and then Case #1 : Trac wrapping them in an ExtensionPoint . Trac Component architecture The Interface will have methods defined in them that Writing a plugin Example can be overridden by user created Components that Pros/Cons Case #2 : implement the interface. py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

  13. Trac : Example plugin Plugin 1 # F o l l o w i n g i s the code i n the a p p l i c a t i o n frameworks 2 # The i n t e r f a c e and i t ’ s s p e c i f i c a t i o n noufal 3 c l a s s ITodoObserver ( I n t e r f a c e ) : 4 def todo added (name , d e s c r i p t i o n ) : 5 ” C a l l e d when a to − do item i s added . ” Introduction 6 About me 7 c l a s s TodoList ( Component ) : About this talk 8 # D e c l a r a t i o n of an e x t e n s i o n p o i n t Plugin 9 o b s e r v e r s = E x t e n s i o n P o i n t ( ITodoObserver ) frameworks 10 Case #1 : 11 def i n i t ( s e l f ) : Trac 12 s e l f . todos = {} Trac Component 13 architecture 14 def add ( s e l f , name , d e s c r i p t i o n ) : Writing a plugin 15 a s s e r t not name i n s e l f . todos , ’To − do a l r e a d y i n l i s t ’ Example 16 s e l f . todos [ name ] = d e s c r i p t i o n Pros/Cons 17 f o r o b s e r v e r i n s e l f . o b s e r v e r s : # Using the e x t e n s i o n p o i n t Case #2 : 18 o b s e r v e r . todo added (name , d e s c r i p t i o n ) py.test 19 20 Metaprogramming 21 # A p l u g i n that p r i n t s out d e t a i l s when something i s added Writing a plugin 22 TodoPrinter ( Component ) : c l a s s Example 23 # S t a t i n g which i n t e r f a c e i s implemented Pros/Cons 24 implements ( ITodoObserver ) Case #3 : 25 Emacs 26 todo added ( s e l f , name , d e s c r i p t i o n ) : def Embedded 27 p r i n y t ’TODO: ’ , name scripting 28 ’ ’ , d e s c r i p t i o n p r i n t language Writing a plugin Example

  14. Trac : Pros/Cons Plugin frameworks noufal Introduction About me About this talk Plugin Pros frameworks Very “Object Oriented” Case #1 : Trac Cons Trac Component architecture Writing a plugin High entry barrier (need to learn “plugin API”) Example Pros/Cons Lots of boilerplate code Case #2 : py.test Metaprogramming Writing a plugin Example Pros/Cons Case #3 : Emacs Embedded scripting language Writing a plugin Example

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend