SlideShare a Scribd company logo
1 of 32
Launchpad
   The good, the bad, and
the OMG how does that work?

                                  Tim Penhey
                              tim@penhey.net
                                 IRC: thumper
                                       #nzpug

                                Kiwi PyCon 2009
Launchpad? WTF is Launchpad?
●   Python based web application
●   ~350k lines of python
●   ~25k tests
●   Uses Zope 3 and Twisted libraries
●   Developed primarily by Canonical
●   AGPL3 now
●   https://launchpad.net

                                        Kiwi PyCon 2009
Kiwi PyCon 2009
Learn From Others
●   Been in development for over five years
●   Made lots of mistakes
●   Found many ways not to do things
●   Nuggets hidden in the depths
●   Here to share




                                              Kiwi PyCon 2009
Testing is Essential
●   All types of tests throughout the code
●   Unit tests
●   Doc tests
●   Acceptance level tests
●   Windmill Javascript tests
●   Run your tests automatically


                                             Kiwi PyCon 2009
Slow Tests are Bad
●   Complete test suite run takes around four hours
●   Cannot run all tests for every landing now
    ●   Buildbot, devel and stable branches
●   Sample data for tests causes problems
    ●   tearDown needs to reset DB state
●   Zope test layers proliferate
●   Run the test in the lowest layer possible

                                                Kiwi PyCon 2009
Code Reviews Are Good
●   All changes are reviewed by at least one other
    developer
●   New team members went through a mentoring
    process to learn from other reviewers
●   Extra eyes on code can spot issues that the
    developer misses
●   Reviewer makes sure new code has tests
●   Have a coding standard
                                           Kiwi PyCon 2009
Multiple Environments are Good
●   Production – updated every four weeks
    ●   https://launchpad.net
●   Edge – updated nightly
    ●   https://edge.launchpad.net
    ●   Beta testers are automatically redirected here
●   Staging – updated nightly with production copy
    ●   https://staging.launchpad.net
    ●   Test area for people to mess around with
                                                   Kiwi PyCon 2009
Can lead to many branches
●   devel – primary development branch
●   stable – devel with all tests passed
    ●   Rolled to edge nightly
●   db-devel – database patches + devel
●   db-stable – db-devel with all the tests passed
    ●   Rolled to staging nightly
●   production – what we rolled out + cherry picks

                                            Kiwi PyCon 2009
Bazaar makes it all workable
●   Bazaar is a distributed revision control system
    (DVCS)
●   Merging just works
●   Develop in branches
●   Merge into devel (or db-devel)




                                            Kiwi PyCon 2009
Object-Relational Mappers
●   Mixed blessing
●   Originally used SQLObject
●   Moved to Storm
    ●   http://storm.canonical.com




                                     Kiwi PyCon 2009
Branches
●   Represent bazaar branches in Launchpad
●   Have owners
●   Most belong to a project or source package
●   Branches can be linked to be “official”
    ●   lp:bzr
    ●   lp:ubunutu/jaunty/gwibber
    ●   lp:~thumper/launchpad/fix-branch-layout


                                                  Kiwi PyCon 2009
Branch Listings
●   Shows up to 100 branches on a page
●   Primary text is the “bazaar identity”
●   For any single branch it can effectively traverse
    across 8 tables
●   Naïve approach would mean 800 queries to
    show a listing



                                             Kiwi PyCon 2009
Branch Listing Solution
●   Utility class – BranchListingQueryOptimiser
●   lazr.delegates
    ●   Wraps real object but can override specific method
●   View class determines visible batch
●   Single queries executed for the “set” of visible
    branches



                                                  Kiwi PyCon 2009
Branch Collection Idiom
●   Global utility to get all branches
      >>> collection = getUtility(IAllBranches)
●   Filter methods return a new branch collection
      >>> collection = collection.inProject(foo)
      >>> collection = collection.ownedBy(eric)
●   Subclasses handle visibility based on privacy
      >>> collection = collection.visibleBy(user)
      >>> collection = collection.visibleBy(None)


                                           Kiwi PyCon 2009
Branch Collection Idiom
●   Accessor methods return result sets
        >>> branches = collection.getBranches()
        >>> branches.order_by(Branch.name)


●   Look at the code:
    ●   lib/lp/code/model/branchcollection.py
    ●   lib/lp/code/interfaces/branchcollection.py



                                                Kiwi PyCon 2009
Interfaces are Good
●   zope.interface and zope.schema
    ●   schema contains field types


    class IFruit(Interface):
        name = Text(required=True)
        def throw(target):
          """No self defined for methods."""



                                               Kiwi PyCon 2009
Interfaces are Good
●   Model classes implement interfaces

    class Fruit(object):
      implements(IFruit)
      def __init__(self, name):
        self.name = name
      def throw(self, target):
        return target.hit_with(self)


                                         Kiwi PyCon 2009
Interfaces are Good
>>> apple = Fruit('apple')
>>> IFruit.providedBy(apple)
True
>>> from zope.interfaces.verify import (
...    verifyObject)
>>> verifyObject(IFruit, apple)
True




                                       Kiwi PyCon 2009
Zope Views and Pages
●   Path traversal is mostly object traversal
●   Views are associated with objects through
    interfaces
●   Resulting web pages are rendered views
●   Most views use a page template




                                                Kiwi PyCon 2009
Adapters Supercharge Interfaces
●   Adapters allow an object to be converted to a
    different interface in a defined way

    def branch_collection_for_product(project):
        """Adapt a project to a branch collection."""
        return getUtility(IAllBranches).inProject(project)


    >>> collection = IBranchCollection(project)




                                                   Kiwi PyCon 2009
Be Smart About Pages
●   Many different objects have branches
●   Simple branch listing registered against
    IHasBranches instead of individual interfaces
●   View adapts the objects to IBranchCollection
●   Each object that implements IHasBranches
    also has an IBranchCollection adapter



                                           Kiwi PyCon 2009
Launchpad API using lazr.restful
●   Annotations to the interface class allow the
    objects to be exposed over a ReST based API
●   This is still magic to me
●   lazr.restful and lazr.restfulclient are found on
    Launchpad
●   launchpadlib is a Python client API



                                               Kiwi PyCon 2009
Modules Matter
●   Initially all of Launchpad was in the
    canonical.launchpad module
    ●   .browser – contained the views
    ●   .interfaces – contained all the interfaces
    ●   .database – contained all the model code
    ●   .templates – contained all the page templates
    ●   .doc – documentation including doc tests
    ●   .ftests, .pagetests, .webapp, …
●   Became just too cumbersome
                                                     Kiwi PyCon 2009
The Module Move Apocalypse
●   Each team was responsible for moving code
●   New base module “lp” chosen
●   lp.registry – people, projects, distributions
●   lp.bugs – code related to the bug tracker
●   lp.services – code used by other applications
    ●   mail, jobs, testing, scripts
●   lp.codehosting, lp.blueprints, lp.translations

                                               Kiwi PyCon 2009
ZCML Is Not Fun
●   Zope Configuration Markup Language is an
    XML document
●   Defines content classes, security, adapters,
    utilities, views
●   Registration away from the actual code hinders
    discoverability
●   Ideally we'd like to bring in some of the ideas
    from Grok and Martian

                                              Kiwi PyCon 2009
Learn to use TAGS
●   TAGS are used describe the location of the
    function definition
●   Can be read by Emacs and Vi
●   Have a make target (or equivalent) to build your
    TAGS file




                                            Kiwi PyCon 2009
Databases Evolve
●   Your database schema will evolve
    ●   New tables and columns
    ●   Changing columns
    ●   With time comes complexity
●   Have a way to evolve your database schema
    ●   Launchpad uses SQL patch files to describe
        discrete changes
    ●   Production database is updated every 4 weeks

                                                Kiwi PyCon 2009
Share Common Components
●   lazr-js               ●   lazr.publisher
●   lazr.authentication   ●   lazr.restful
●   lazr.batchnavigator   ●   lazr.restfulclient
●   lazr.canonicalurl     ●   lazr.smtptest
●   lazr.config           ●   lazr.testing
●   lazr.delegates        ●   lazr.uri
●   lazr.enum             ●   storm
●   lazr.exportedfolder   ●   wadllib
●   lazr.lifecycle

                                                   Kiwi PyCon 2009
Eat Your Own Dog Food




                        Kiwi PyCon 2009
That's It



Questions?




             Kiwi PyCon 2009
Lunch!




         Kiwi PyCon 2009

More Related Content

What's hot

GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18Jorge Hidalgo
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28Jorge Hidalgo
 
Eclipsecon 2010 - Scala Support in Eclipse
Eclipsecon 2010 - Scala Support in EclipseEclipsecon 2010 - Scala Support in Eclipse
Eclipsecon 2010 - Scala Support in EclipseMiles Sabin
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyelliando dias
 
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?Miles Sabin
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerKoichi Sakata
 
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?Miles Sabin
 
The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa InitiativeNuvole
 
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOUHOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOULucas Jellema
 
Java 9 Modules: The Duke Yet Lives That OSGi Shall Depose
Java 9 Modules: The Duke Yet Lives That OSGi Shall DeposeJava 9 Modules: The Duke Yet Lives That OSGi Shall Depose
Java 9 Modules: The Duke Yet Lives That OSGi Shall DeposeNikita Lipsky
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devopsRob Kinyon
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.jsJustin Reock
 
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)ARB_gl_spirv implementation in Mesa: status update (XDC 2018)
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)Igalia
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl ProgrammerJohn Anderson
 
Deploying PHP Application Using Bitbucket Pipelines
Deploying PHP Application Using Bitbucket PipelinesDeploying PHP Application Using Bitbucket Pipelines
Deploying PHP Application Using Bitbucket PipelinesDolly Aswin Harahap
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Clark Everetts
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginnersAdam Englander
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deploymentThilo Utke
 
DEVNET-2006 Coding 210: Parsing JSON in C++
DEVNET-2006	Coding 210: Parsing JSON in C++DEVNET-2006	Coding 210: Parsing JSON in C++
DEVNET-2006 Coding 210: Parsing JSON in C++Cisco DevNet
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in osGenchiLu1
 

What's hot (20)

GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18GraalVM - OpenSlava 2019-10-18
GraalVM - OpenSlava 2019-10-18
 
GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28GraalVM - JBCNConf 2019-05-28
GraalVM - JBCNConf 2019-05-28
 
Eclipsecon 2010 - Scala Support in Eclipse
Eclipsecon 2010 - Scala Support in EclipseEclipsecon 2010 - Scala Support in Eclipse
Eclipsecon 2010 - Scala Support in Eclipse
 
JRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRubyJRoR Deploying Rails on JRuby
JRoR Deploying Rails on JRuby
 
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
JVM Languages Support in Eclipse - Monkey-patching the JDT for fun and profit?
 
Graal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT CompilerGraal in GraalVM - A New JIT Compiler
Graal in GraalVM - A New JIT Compiler
 
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
Scala Support in Eclipse - Monkey-patching the JDT for fun and profit?
 
The OpenEuropa Initiative
The OpenEuropa InitiativeThe OpenEuropa Initiative
The OpenEuropa Initiative
 
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOUHOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
HOW AND WHY GRAALVM IS QUICKLY BECOMING RELEVANT FOR YOU
 
Java 9 Modules: The Duke Yet Lives That OSGi Shall Depose
Java 9 Modules: The Duke Yet Lives That OSGi Shall DeposeJava 9 Modules: The Duke Yet Lives That OSGi Shall Depose
Java 9 Modules: The Duke Yet Lives That OSGi Shall Depose
 
Ruby, the language of devops
Ruby, the language of devopsRuby, the language of devops
Ruby, the language of devops
 
Getting Started with Node.js
Getting Started with Node.jsGetting Started with Node.js
Getting Started with Node.js
 
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)ARB_gl_spirv implementation in Mesa: status update (XDC 2018)
ARB_gl_spirv implementation in Mesa: status update (XDC 2018)
 
Modern Perl for the Unfrozen Paleolithic Perl Programmer
Modern Perl for the Unfrozen Paleolithic  Perl ProgrammerModern Perl for the Unfrozen Paleolithic  Perl Programmer
Modern Perl for the Unfrozen Paleolithic Perl Programmer
 
Deploying PHP Application Using Bitbucket Pipelines
Deploying PHP Application Using Bitbucket PipelinesDeploying PHP Application Using Bitbucket Pipelines
Deploying PHP Application Using Bitbucket Pipelines
 
Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016Php Dependency Management with Composer ZendCon 2016
Php Dependency Management with Composer ZendCon 2016
 
Zend con 2016 bdd with behat for beginners
Zend con 2016   bdd with behat for beginnersZend con 2016   bdd with behat for beginners
Zend con 2016 bdd with behat for beginners
 
Mac ruby deployment
Mac ruby deploymentMac ruby deployment
Mac ruby deployment
 
DEVNET-2006 Coding 210: Parsing JSON in C++
DEVNET-2006	Coding 210: Parsing JSON in C++DEVNET-2006	Coding 210: Parsing JSON in C++
DEVNET-2006 Coding 210: Parsing JSON in C++
 
Understanding how concurrency work in os
Understanding how concurrency work in osUnderstanding how concurrency work in os
Understanding how concurrency work in os
 

Similar to Understanding Launchpad: A Deep Dive into the Open Source Project Management Platform

MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and ProfitJoshua Ballanco
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinatingAntonio Goncalves
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplateStanislav Petrov
 
Pipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodePipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodeKris Buytaert
 
Django Deployment with Fabric
Django Deployment with FabricDjango Deployment with Fabric
Django Deployment with FabricJonas Nockert
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ TokopediaQasim Zaidi
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Waysmalltown
 
JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?Charlie Gracie
 
Jenkinsconf Presentation - Advance jenkins management with multiple projects.
Jenkinsconf Presentation - Advance jenkins management with multiple projects.Jenkinsconf Presentation - Advance jenkins management with multiple projects.
Jenkinsconf Presentation - Advance jenkins management with multiple projects.Ohad Basan
 
Cloud Native Practice
Cloud Native PracticeCloud Native Practice
Cloud Native PracticePhilip Zheng
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React NativeWaqqas Jabbar
 
Ruby on rails探索
Ruby on rails探索Ruby on rails探索
Ruby on rails探索Mu Chun Wang
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with serverEugene Yokota
 
Repository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryRepository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryStephen Chin
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime
 
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...DynamicInfraDays
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangriaJorge Morales
 

Similar to Understanding Launchpad: A Deep Dive into the Open Source Project Management Platform (20)

MacRuby for Fun and Profit
MacRuby for Fun and ProfitMacRuby for Fun and Profit
MacRuby for Fun and Profit
 
Are app servers still fascinating
Are app servers still fascinatingAre app servers still fascinating
Are app servers still fascinating
 
Creating a reasonable project boilerplate
Creating a reasonable project boilerplateCreating a reasonable project boilerplate
Creating a reasonable project boilerplate
 
Pipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as CodePipeline as code for your infrastructure as Code
Pipeline as code for your infrastructure as Code
 
Django Deployment with Fabric
Django Deployment with FabricDjango Deployment with Fabric
Django Deployment with Fabric
 
Golang @ Tokopedia
Golang @ TokopediaGolang @ Tokopedia
Golang @ Tokopedia
 
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps WayDevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
DevOpsDays Taipei 2019 - Mastering IaC the DevOps Way
 
JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?JavaOne2015-What's in an Object?
JavaOne2015-What's in an Object?
 
Jenkinsconf Presentation - Advance jenkins management with multiple projects.
Jenkinsconf Presentation - Advance jenkins management with multiple projects.Jenkinsconf Presentation - Advance jenkins management with multiple projects.
Jenkinsconf Presentation - Advance jenkins management with multiple projects.
 
Cloud Native Practice
Cloud Native PracticeCloud Native Practice
Cloud Native Practice
 
Introduction to React Native
Introduction to React NativeIntroduction to React Native
Introduction to React Native
 
Ruby on rails探索
Ruby on rails探索Ruby on rails探索
Ruby on rails探索
 
Road to sbt 1.0 paved with server
Road to sbt 1.0   paved with serverRoad to sbt 1.0   paved with server
Road to sbt 1.0 paved with server
 
Repository Management with JFrog Artifactory
Repository Management with JFrog ArtifactoryRepository Management with JFrog Artifactory
Repository Management with JFrog Artifactory
 
The Architect Way
The Architect WayThe Architect Way
The Architect Way
 
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
CodiLime Tech Talk - Dawid Trzebiatowski i Wojciech Urbański: Opening the Flo...
 
Pipeline as Code
Pipeline as CodePipeline as Code
Pipeline as Code
 
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
ContainerDays NYC 2015: "Easing Your Way Into Docker: Lessons From a Journey ...
 
Container Days
Container DaysContainer Days
Container Days
 
Odo improving the developer experience on OpenShift - hack & sangria
Odo   improving the developer experience on OpenShift - hack & sangriaOdo   improving the developer experience on OpenShift - hack & sangria
Odo improving the developer experience on OpenShift - hack & sangria
 

Recently uploaded

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)wesley chun
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Recently uploaded (20)

08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Understanding Launchpad: A Deep Dive into the Open Source Project Management Platform

  • 1. Launchpad The good, the bad, and the OMG how does that work? Tim Penhey tim@penhey.net IRC: thumper #nzpug Kiwi PyCon 2009
  • 2. Launchpad? WTF is Launchpad? ● Python based web application ● ~350k lines of python ● ~25k tests ● Uses Zope 3 and Twisted libraries ● Developed primarily by Canonical ● AGPL3 now ● https://launchpad.net Kiwi PyCon 2009
  • 4. Learn From Others ● Been in development for over five years ● Made lots of mistakes ● Found many ways not to do things ● Nuggets hidden in the depths ● Here to share Kiwi PyCon 2009
  • 5. Testing is Essential ● All types of tests throughout the code ● Unit tests ● Doc tests ● Acceptance level tests ● Windmill Javascript tests ● Run your tests automatically Kiwi PyCon 2009
  • 6. Slow Tests are Bad ● Complete test suite run takes around four hours ● Cannot run all tests for every landing now ● Buildbot, devel and stable branches ● Sample data for tests causes problems ● tearDown needs to reset DB state ● Zope test layers proliferate ● Run the test in the lowest layer possible Kiwi PyCon 2009
  • 7. Code Reviews Are Good ● All changes are reviewed by at least one other developer ● New team members went through a mentoring process to learn from other reviewers ● Extra eyes on code can spot issues that the developer misses ● Reviewer makes sure new code has tests ● Have a coding standard Kiwi PyCon 2009
  • 8. Multiple Environments are Good ● Production – updated every four weeks ● https://launchpad.net ● Edge – updated nightly ● https://edge.launchpad.net ● Beta testers are automatically redirected here ● Staging – updated nightly with production copy ● https://staging.launchpad.net ● Test area for people to mess around with Kiwi PyCon 2009
  • 9. Can lead to many branches ● devel – primary development branch ● stable – devel with all tests passed ● Rolled to edge nightly ● db-devel – database patches + devel ● db-stable – db-devel with all the tests passed ● Rolled to staging nightly ● production – what we rolled out + cherry picks Kiwi PyCon 2009
  • 10. Bazaar makes it all workable ● Bazaar is a distributed revision control system (DVCS) ● Merging just works ● Develop in branches ● Merge into devel (or db-devel) Kiwi PyCon 2009
  • 11. Object-Relational Mappers ● Mixed blessing ● Originally used SQLObject ● Moved to Storm ● http://storm.canonical.com Kiwi PyCon 2009
  • 12. Branches ● Represent bazaar branches in Launchpad ● Have owners ● Most belong to a project or source package ● Branches can be linked to be “official” ● lp:bzr ● lp:ubunutu/jaunty/gwibber ● lp:~thumper/launchpad/fix-branch-layout Kiwi PyCon 2009
  • 13. Branch Listings ● Shows up to 100 branches on a page ● Primary text is the “bazaar identity” ● For any single branch it can effectively traverse across 8 tables ● Naïve approach would mean 800 queries to show a listing Kiwi PyCon 2009
  • 14. Branch Listing Solution ● Utility class – BranchListingQueryOptimiser ● lazr.delegates ● Wraps real object but can override specific method ● View class determines visible batch ● Single queries executed for the “set” of visible branches Kiwi PyCon 2009
  • 15. Branch Collection Idiom ● Global utility to get all branches >>> collection = getUtility(IAllBranches) ● Filter methods return a new branch collection >>> collection = collection.inProject(foo) >>> collection = collection.ownedBy(eric) ● Subclasses handle visibility based on privacy >>> collection = collection.visibleBy(user) >>> collection = collection.visibleBy(None) Kiwi PyCon 2009
  • 16. Branch Collection Idiom ● Accessor methods return result sets >>> branches = collection.getBranches() >>> branches.order_by(Branch.name) ● Look at the code: ● lib/lp/code/model/branchcollection.py ● lib/lp/code/interfaces/branchcollection.py Kiwi PyCon 2009
  • 17. Interfaces are Good ● zope.interface and zope.schema ● schema contains field types class IFruit(Interface): name = Text(required=True) def throw(target): """No self defined for methods.""" Kiwi PyCon 2009
  • 18. Interfaces are Good ● Model classes implement interfaces class Fruit(object): implements(IFruit) def __init__(self, name): self.name = name def throw(self, target): return target.hit_with(self) Kiwi PyCon 2009
  • 19. Interfaces are Good >>> apple = Fruit('apple') >>> IFruit.providedBy(apple) True >>> from zope.interfaces.verify import ( ... verifyObject) >>> verifyObject(IFruit, apple) True Kiwi PyCon 2009
  • 20. Zope Views and Pages ● Path traversal is mostly object traversal ● Views are associated with objects through interfaces ● Resulting web pages are rendered views ● Most views use a page template Kiwi PyCon 2009
  • 21. Adapters Supercharge Interfaces ● Adapters allow an object to be converted to a different interface in a defined way def branch_collection_for_product(project): """Adapt a project to a branch collection.""" return getUtility(IAllBranches).inProject(project) >>> collection = IBranchCollection(project) Kiwi PyCon 2009
  • 22. Be Smart About Pages ● Many different objects have branches ● Simple branch listing registered against IHasBranches instead of individual interfaces ● View adapts the objects to IBranchCollection ● Each object that implements IHasBranches also has an IBranchCollection adapter Kiwi PyCon 2009
  • 23. Launchpad API using lazr.restful ● Annotations to the interface class allow the objects to be exposed over a ReST based API ● This is still magic to me ● lazr.restful and lazr.restfulclient are found on Launchpad ● launchpadlib is a Python client API Kiwi PyCon 2009
  • 24. Modules Matter ● Initially all of Launchpad was in the canonical.launchpad module ● .browser – contained the views ● .interfaces – contained all the interfaces ● .database – contained all the model code ● .templates – contained all the page templates ● .doc – documentation including doc tests ● .ftests, .pagetests, .webapp, … ● Became just too cumbersome Kiwi PyCon 2009
  • 25. The Module Move Apocalypse ● Each team was responsible for moving code ● New base module “lp” chosen ● lp.registry – people, projects, distributions ● lp.bugs – code related to the bug tracker ● lp.services – code used by other applications ● mail, jobs, testing, scripts ● lp.codehosting, lp.blueprints, lp.translations Kiwi PyCon 2009
  • 26. ZCML Is Not Fun ● Zope Configuration Markup Language is an XML document ● Defines content classes, security, adapters, utilities, views ● Registration away from the actual code hinders discoverability ● Ideally we'd like to bring in some of the ideas from Grok and Martian Kiwi PyCon 2009
  • 27. Learn to use TAGS ● TAGS are used describe the location of the function definition ● Can be read by Emacs and Vi ● Have a make target (or equivalent) to build your TAGS file Kiwi PyCon 2009
  • 28. Databases Evolve ● Your database schema will evolve ● New tables and columns ● Changing columns ● With time comes complexity ● Have a way to evolve your database schema ● Launchpad uses SQL patch files to describe discrete changes ● Production database is updated every 4 weeks Kiwi PyCon 2009
  • 29. Share Common Components ● lazr-js ● lazr.publisher ● lazr.authentication ● lazr.restful ● lazr.batchnavigator ● lazr.restfulclient ● lazr.canonicalurl ● lazr.smtptest ● lazr.config ● lazr.testing ● lazr.delegates ● lazr.uri ● lazr.enum ● storm ● lazr.exportedfolder ● wadllib ● lazr.lifecycle Kiwi PyCon 2009
  • 30. Eat Your Own Dog Food Kiwi PyCon 2009
  • 31. That's It Questions? Kiwi PyCon 2009
  • 32. Lunch! Kiwi PyCon 2009