SlideShare une entreprise Scribd logo
1  sur  21
Télécharger pour lire hors ligne
Pyramid
"Pay only for what you eat"
http://bit.ly/bcnmeetup-pyramid
Víctor Fernández de Alba
Lead web developer at Barcelona Tech University
Author of Plone 3 Intranets (2010, PacktPub)
Developing Plone sites since 2004
Developing Pyramid applications since its early betas
- /Víctor's Blog @sneridagh
Brief history
Pylons (2005-2010)
+
repoze.bfg (2008-2010)
=
Pyramid (2010- )
Joined under the same umbrella, the
TurboGears joined to the project few months later
Version 1.4 supports Python 2.6 ~ 3.x
Pylons Project
Simplicity
About ~5000 lines of code
Minimalism
Try to solve the fundamental problems
Mapping URLs to code
Templating
Security
Serve static assets
Documentation
Just a word... awesome
Obsessively up-to-date
More than 800 printed pages
Speed
Optimized for fast code execution
Reliability
100% obsessive tested
"If it ain’t tested, it’s broke"
and...
Beautifuly pythonic
Pragmatism everywhere
Lots of: "Fuck, yeah!"
Heavy influence of Zope
Chris McDonough
Configuration via zcml (optional, not core)
Component architecture (zope.component)
ZODB (optional, not enforced)
URL Traversal concept
Single file application
from wsgiref.simple_server import make_server
from pyramid.config import Configurator
from pyramid.response import Response
def hello_world(request):
return Response('Hello %(name)s!' % request.matchdict)
if __name__ == '__main__':
config = Configurator()
config.add_route('hello', '/hello/{name}')
config.add_view(hello_world, route_name='hello')
app = config.make_wsgi_app()
server = make_server('0.0.0.0', 8080, app)
server.serve_forever()
Application configuration
Declarative (previous example)
Imperative (via decorators)
from pyramid.response import Response
from pyramid.view import view_config
@view_config(name='hello', request_method='GET')
def hello(request):
return Response('Hello')
Developer tools
Setuptools/Distribute compliant
Project scaffolding
Convenience scripts
Debug toolbar
Templating
Chameleon (Zope Page Templates clone)
Mako
Jinja2
Virtually any other pythonic template system
Persistence
SQLAlchemy (OOTB)
ZODB (OOTB)
MongoDB
Virtually any other persistence system or database
Security
High level of granularity
Extensible
Pluggable
Local, LDAP, SQL, oAuth providers, etc.
Miscelaneous
Pastedeploy configuration
i18n
Event system
Hooks
Tweens concept
Session management
Cornice: A REST framework for
Pyramid
[..]
from cornice import Service
info_desc = """This service is useful to get and set data for a user."""
user_info = Service(name='users', path='/{username}/info',
description=info_desc)
_USERS = defaultdict(dict)
@user_info.get()
def get_info(request):
"""Returns the public information about a **user**.
If the user does not exists, returns an empty dataset.
"""
username = request.matchdict['username']
return _USERS[username]
Cornice: A REST framework for
Pyramid (II)
@user_info.post()
def set_info(request):
"""Set the public information for a **user**.
You have to be that user, and *authenticated*.
Returns *True* or *False*.
"""
username = authenticated_userid(request)
if request.matchdict["username"] != username:
raise Forbidden()
_USERS[username] = request.json_body
return {'success': True}
Resources
http://docs.pylonsproject.org/
http://cornice.readthedocs.org/
https://github.com/pylons
Sorry for the
convenience

Contenu connexe

Similaire à Introduction to Pyramid

Python Application with Real World Examples
Python Application with Real World ExamplesPython Application with Real World Examples
Python Application with Real World ExamplesTarun Saini
 
C4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web FrameworkC4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web FrameworkFrancis Addai
 
Bootstrapping Your Python Career
Bootstrapping Your Python CareerBootstrapping Your Python Career
Bootstrapping Your Python CareerNejc Zupan
 
Real World Examples and Python Application
Real World Examples and Python ApplicationReal World Examples and Python Application
Real World Examples and Python ApplicationTarun Saini
 
Behold the Power of Python
Behold the Power of PythonBehold the Power of Python
Behold the Power of PythonSarah Dutkiewicz
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorialmasukmia.com
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unitmichaelaaron25322
 
Python, Django. Why to learn?
Python, Django. Why to learn?Python, Django. Why to learn?
Python, Django. Why to learn?Oleh Korkh
 
Python Classes in Pune
Python Classes in PunePython Classes in Pune
Python Classes in PuneClassboat.com
 
pycon-2015-liza-daly
pycon-2015-liza-dalypycon-2015-liza-daly
pycon-2015-liza-dalyLiza Daly
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PunePython Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PuneEthan's Tech
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Bruno R. Zanuzzo
 
Python Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in PythonPython Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in Pythonabhishekdf3
 

Similaire à Introduction to Pyramid (20)

Python Application with Real World Examples
Python Application with Real World ExamplesPython Application with Real World Examples
Python Application with Real World Examples
 
C4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web FrameworkC4ainaction-Introduction to the Pyramid Web Framework
C4ainaction-Introduction to the Pyramid Web Framework
 
Python
Python Python
Python
 
5 Thomas Magedanz
5  Thomas Magedanz5  Thomas Magedanz
5 Thomas Magedanz
 
Python Final
Python FinalPython Final
Python Final
 
Bootstrapping Your Python Career
Bootstrapping Your Python CareerBootstrapping Your Python Career
Bootstrapping Your Python Career
 
what is python ?
what is python ? what is python ?
what is python ?
 
Real World Examples and Python Application
Real World Examples and Python ApplicationReal World Examples and Python Application
Real World Examples and Python Application
 
Behold the Power of Python
Behold the Power of PythonBehold the Power of Python
Behold the Power of Python
 
Python slide basic to advanced english tutorial
Python slide basic to advanced english tutorialPython slide basic to advanced english tutorial
Python slide basic to advanced english tutorial
 
Python programming language introduction unit
Python programming language introduction unitPython programming language introduction unit
Python programming language introduction unit
 
Doing the Impossible
Doing the ImpossibleDoing the Impossible
Doing the Impossible
 
Python, Django. Why to learn?
Python, Django. Why to learn?Python, Django. Why to learn?
Python, Django. Why to learn?
 
Python Classes in Pune
Python Classes in PunePython Classes in Pune
Python Classes in Pune
 
pycon-2015-liza-daly
pycon-2015-liza-dalypycon-2015-liza-daly
pycon-2015-liza-daly
 
Introduction to Python
Introduction to PythonIntroduction to Python
Introduction to Python
 
Programming Gives You Superpowers
Programming Gives You SuperpowersProgramming Gives You Superpowers
Programming Gives You Superpowers
 
Python Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech PunePython Training in Pune - Ethans Tech Pune
Python Training in Pune - Ethans Tech Pune
 
Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015Python: the secret weapon of Fedora - FLISoL 2015
Python: the secret weapon of Fedora - FLISoL 2015
 
Python Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in PythonPython Web Framework – A Detailed List of Web Frameworks in Python
Python Web Framework – A Detailed List of Web Frameworks in Python
 

Plus de sneridagh

Meet Quanta - Plone's Style Guide
Meet Quanta - Plone's Style GuideMeet Quanta - Plone's Style Guide
Meet Quanta - Plone's Style Guidesneridagh
 
Plone 5 theming
Plone 5 themingPlone 5 theming
Plone 5 themingsneridagh
 
MAX: Realtime messaging and activity stream engine
MAX: Realtime messaging and activity stream engineMAX: Realtime messaging and activity stream engine
MAX: Realtime messaging and activity stream enginesneridagh
 
Key factors of the content management
Key factors of the content managementKey factors of the content management
Key factors of the content managementsneridagh
 
Factors claus de la gestió de continguts
Factors claus de la gestió de contingutsFactors claus de la gestió de continguts
Factors claus de la gestió de contingutssneridagh
 
Plone 5 theming unleashed
Plone 5 theming unleashedPlone 5 theming unleashed
Plone 5 theming unleashedsneridagh
 
Arquitectura de serveis per aplicacions mòbils
Arquitectura de serveis per aplicacions mòbilsArquitectura de serveis per aplicacions mòbils
Arquitectura de serveis per aplicacions mòbilssneridagh
 

Plus de sneridagh (7)

Meet Quanta - Plone's Style Guide
Meet Quanta - Plone's Style GuideMeet Quanta - Plone's Style Guide
Meet Quanta - Plone's Style Guide
 
Plone 5 theming
Plone 5 themingPlone 5 theming
Plone 5 theming
 
MAX: Realtime messaging and activity stream engine
MAX: Realtime messaging and activity stream engineMAX: Realtime messaging and activity stream engine
MAX: Realtime messaging and activity stream engine
 
Key factors of the content management
Key factors of the content managementKey factors of the content management
Key factors of the content management
 
Factors claus de la gestió de continguts
Factors claus de la gestió de contingutsFactors claus de la gestió de continguts
Factors claus de la gestió de continguts
 
Plone 5 theming unleashed
Plone 5 theming unleashedPlone 5 theming unleashed
Plone 5 theming unleashed
 
Arquitectura de serveis per aplicacions mòbils
Arquitectura de serveis per aplicacions mòbilsArquitectura de serveis per aplicacions mòbils
Arquitectura de serveis per aplicacions mòbils
 

Dernier

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businesspanagenda
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDropbox
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMKumar Satyam
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...apidays
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWERMadyBayot
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistandanishmna97
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfOrbitshub
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityWSO2
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAnitaRaj43
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontologyjohnbeverley2021
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKJago de Vreede
 

Dernier (20)

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Introduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDMIntroduction to use of FHIR Documents in ABDM
Introduction to use of FHIR Documents in ABDM
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
CNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In PakistanCNIC Information System with Pakdata Cf In Pakistan
CNIC Information System with Pakdata Cf In Pakistan
 
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdfRising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
Rising Above_ Dubai Floods and the Fortitude of Dubai International Airport.pdf
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
AI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by AnitarajAI in Action: Real World Use Cases by Anitaraj
AI in Action: Real World Use Cases by Anitaraj
 
Six Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal OntologySix Myths about Ontologies: The Basics of Formal Ontology
Six Myths about Ontologies: The Basics of Formal Ontology
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUKSpring Boot vs Quarkus the ultimate battle - DevoxxUK
Spring Boot vs Quarkus the ultimate battle - DevoxxUK
 

Introduction to Pyramid