Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Pyramid faq


Published on

Published in: Technology
  • Be the first to comment

Pyramid faq

  1. 2. Not built by aliens
  2. 3. It's not, really <ul><li>Pyramid is not built by aliens.
  3. 4. These aliens are not telepathic. They do not look like human babies.
  4. 5. The Pyramid developers do not worship an ancient crocodile god.
  5. 6. The source code for Pyramid is not over 5,000 years old.
  6. 7. For complete and emphatic denials see: </li></ul>
  7. 8. Listening to your users <ul><li>IRC channels (#pyramid, #pylons).
  8. 9. Mailing lists (pylons-discuss, pylons-devel).
  9. 10. Twitter, Convore, etc.
  10. 11. Reddit, Ycombinator, etc.
  11. 12. Blogs. </li></ul>
  12. 13. Different kinds of FAQs <ul><li>What?
  13. 14. Where?
  14. 15. How?
  15. 16. Why?
  16. 17. Critiques
  17. 18. I hate... </li></ul>
  18. 19. Why I love Pyramid?
  19. 20. “ Pyramid is a &quot;Pylons Project&quot; term shall lead to confusion to many People.” “ Hello, I want to know exactly what is the relation b/w these web frameworks.” “ I've had some projects in mind for a while and I was just seeking some clarification regarding frameworks. Pylons, Pyramid, Turbogears and Web2Py in particular.”
  20. 21. The Pylons Project <ul><li>The aim of the project is to develop a related set of web technologies
  21. 22. It's an umbrella name, similar to how the Apache name is used today
  22. 23. Pylons 1 is a stable and maintained web framework, but no further enhancements to it will be done.
  23. 24. Pyramid is the current and future embodiment of Pylons-Style web development
  24. 25. There will be other projects under this umbrella, like TurboGears. </li></ul>
  25. 26. “ Pyramid Provides More Than One Way to Do It” “ Pyramid Does Traversal, And I Don’t Like that” “ Pyramid Has Too Many Dependencies” “ Pyramid Uses A Zope Component Architecture (“ZCA”) Registry”
  26. 27. Design decisions <ul><li>Like all software, Pyramid's developers made design decisions that you may not like.
  27. 28. Still, there was some thinking behind them.
  28. 29. We know we can't convince you, but we can at least explain why those decisions were made.
  29. 30. Pyramid design defense: </li></ul>
  30. 32. “ Do you recommend Pyramid even to those without zope background ?” “ However I still believe the better solution would have been a complete rewrite than merging with repoze with all its Zope baggage .” “ seems to be some zope legacy , I puke every time i see the ZCML or the template language from plone or the zopedb and it's orm”
  31. 33. Pyramid's Zope “baggage”
  32. 34. Zope baggage <ul><li>Pyramid depends directly on zope.component.
  33. 35. There is an optional ZCML package.
  34. 36. Traversal and other Zope concepts can be used or not.
  35. 37. Pyramid doesn't hate Zope, but Pyramid is not Zope. </li></ul>
  36. 38. “ The first impression was, that the whole documentation is very complete, but quite abstract ” “ Pyramid is well has a lot of coverage, but the editing and organization is still quite lacking.” “ I think the problem currently is that people start by going into the main documentation, and then get overwhelmed .”
  37. 39. Pyramid Documentation <ul><li>We are proud of Pyramid's extensive documentation (around 700 printed pages and counting).
  38. 40. But we admit that docs need work.
  39. 41. We are sprinting on it, specially beginner documentation.
  40. 42. That said, do you know about: </li><ul><li>Pyramid cookbook:
  41. 43. Pyramid tutorials: </li></ul></ul>
  42. 44. “ Why doesn't Pyramid give me more rails?”
  43. 46. Opinionated Pyramids <ul><li>Khufu, by Rocky Burt
  44. 47. Akhet, by Mike Orr
  45. 48. Stay tuned for contributions from TurboGears' team
  46. 49. Other opinionated packages will turn up in due time </li></ul>
  47. 50. “ Pyramid or Pylons” “ for someone unfamiliar with either of them, which one, Pyramid or Pylons, would be the best one to begin learning and creating projects with?” “ do you all suggest starting with Pyramids ? Or shall I wait for some more months ?”
  48. 51. New project: Pyramid or Pylons? <ul><li>Pyramid.
  49. 52. Although it's 1.0, remember it existed as repoze.bfg for some years.
  50. 53. If you need to migrate from a Pylons project, you can use both at the same time.
  51. 54. If you are very familiar with Pylons and are unsure how to use Pyramid, we are working on ways to help you </li></ul>
  52. 55. “ I would like to move from Pylons 1.0 to Pyramid, but I'm not going to be able manage a wholesale port any time soon. So, I'm wondering if it would be practical to start using some parts of Pyramid within an existing Pylons project.”
  53. 56. From webob.exc import NotFound class LegacyView(object): def __init__(self, app): = app # app is the legacy Pylons app def __call__(self, request): return request.get_response( if __name__ == '__main__': pylonsapp = ... obtain pylons WSGI application object ... legacy_view = LegacyView(pylonsapp) config = Configurator() config.add_view(context=NotFound, view=legacy_view) Running a Pylons application “inside” a Pyramid application
  54. 57. &quot;The Pyramid manual is overwhelming.&quot; &quot;How to migrate from Pylons&quot; &quot;What's the equivalent of Pylons ``h``?&quot; &quot;How do I port my Pylons controllers to Pyramid?&quot;
  55. 59. Akhet <ul><li>Pyramid application templates inspired by Pylons 1 style.
  56. 60. Makes the transition from Pylons easier.
  57. 61. Almost at beta 1.
  58. 62. Mike's working on it as we speak.
  59. 63. </li></ul>
  60. 64. Current features of Akhet <ul><li>application template: pyramid_sqla or akhet
  61. 65. complete documentation
  62. 66. SQLAlchemy model using pyamid_sqla or SQLAHelper, similar to Pylons
  63. 67. SQLAlchemy transaction management via repoze.tm2
  64. 68. Static files served under &quot;/&quot; overlayed with dynamic URLs, as in Pylons
  65. 69. A module tied to an ``h`` variable in templates
  66. 70. URL dispatch and view handlers, similar to Pylons </li></ul>
  67. 71. Current features of Akhet (II) <ul><li>Templates ending in .html are passed to Mako (or to your desired template engine)
  68. 72. Listen on localhost:5000 by default, as in Pylons
  69. 73. A logger for the application package is configured .
  70. 74. A command-line script to create your database, replacing &quot;paster setup-app&quot; in Pylons </li></ul>
  71. 75. Pyramid Migration FAQ <ul><li>Overview of Pyramid from a Pylons perspective
  72. 76. Differences between the frameworks
  73. 77. (Mostly) finished
  74. 78. Will be part of the official documentation
  75. 79. </li></ul>
  76. 80. “ Traversal seems more powerful than URL dispatch even though I can't fully yet appreciate/comprehend using traversal” “ The traversal approach from the documentation sounded interesting...I took a look...and had no clue how the different pages were addressed” “ Why provide two ways of doing the same thing?”
  77. 81. What is traversal <ul><li>Think of it as serving an old (really old) style web application.
  78. 82. We serve files from a path, '/get/some/file.html'
  79. 83. Some actions may depend on extensions (.cgi, .php, etc.) </li></ul>
  80. 84. What is Traversal (II) <ul><li>But instead of serving files, we serve python objects (resources).
  81. 85. The object (resource) that traversal finds is called the context.
  82. 86. A resource can have several views which are looked up in a registry.
  83. 87. Rob Miller explained this so perfectly in a blog post that it was added to the docs: </li></ul>
  84. 89. When to use traversal <ul><li>Your URL tree is deeply nested or can't be known in advance.
  85. 90. You want an easy way to set row level security. </li></ul>
  86. 91. When to not use traversal <ul><li>You are writing your first Pyramid app and you come from Pylons, Django, etc.
  87. 92. Your URL tree can be known in advance.
  88. 93. You have am “square” data set.
  89. 94. You don't need row level security. </li></ul>
  90. 95. Not built by aliens