SlideShare ist ein Scribd-Unternehmen logo
1 von 19
Downloaden Sie, um offline zu lesen
FLASK!
18 months in @ happify
FLASK NYC 2013
Andy Parsons @andyparsons
This talk
FLASK NYC 2013
E x p e r i e n c e
a n d L e s s o n s
F l a s k
@
H a p p i f y
A n 1 8 - m o n t h - o l d
a c t i v e F l a s k
c o d e b a s e
H o w I g o t t o
F l a s k
Flask has become a
VIBRANT, ACTIVE toolkit
for HTTP servers.
But there aren’t a lot of
large examples from which
to learn. LET’S CHANGE
THAT.
Me.
•startup junkie. masochist.
•co-founder/CTO Happify
•previously CTO Outside.in, bookish, ...
•MENTOR @ seedcamp, techpeaks, 500 Startups
•pragmatist
•love choosing tools, Learning, making them better
not Me.
•Framework zealot
•django expert (no comparisons)
•IDEALIST
what is a “microframework?”
•just the essentials, nothing more
•extensibility through plugins
•readable source
•minimal magic
•easy to build a toy/demo
•lack of patterns for larger projects
FLASK NYC 2013
PROJECT LINES OF CODE COMPLEXITY
Backbone.js < 1000 LOW
Flask (not Werkzeug) ~2000 (?) LOW
Redis 100,000 MEDIUM
Django 170,000 MEDIUM
MongoDB 500,000 HIGH
PostgreSQL > 1,000,000 HIGH!
complexity spectrum
* STATS FROM OHLOH (http://www.ohloh.net/) and http://www.andreas-dewes.de/code_is_beautiful/
‣ java/spring/.NET
‣ a FEW rails-based startups (sinatra mixed in)
‣ scala services (scalatra, play)
‣ Python a natural fit for happify (data analysis, machine learning, nlp)
‣ flask selected as toolkit
my journey to flask
A Sampling of NYC Python
A Startup Junkie's Journey to Python via Java, Ruby and Scala
Andy Parsons
@andyparsons
My Startups and Their Stacks What Are We Building? And in general...
Happiness Speed Magic Readability
BUSINESS WEB API SERVICES DATABASES TEAM SIZE
Pro Photo ASP.NET C#, Perl SQL Server 12
Hyperlocal
Content
(Geolocation
)
RoR Sinatra Scala
PostgreSQL,
MongoDB
10
Ereading and
Book
Recommende
r
RoR Scalatra Scala/Java MongoDB 8
Life Gaming Flask
Python/
Gevent
Python
PostgreSQL,
MongoDB
3
Building Happify: Comparing Language Options
SPEED CONCURRENCY TOOLING
PACKAGING /
DEPENDENCIES
DEPLOYMENT TESTING
FRAMEWORKS
/ LIBS
RUBY
SCALA
PYTHON
Fast enough Achieved through Process.fork
Healthy, lots of
choice
Gems Capistrano Mature
Growing collection
of libs, but weak in
NLP
Fast! Real concurrency,Akka
Still early. IDE’s
weak.
Complex. JARs, SBT, Ivy,
Maven.
? Maturing
Early for native
scala libraries, rely
on Java interop
Fast enough
Achieved through
multiprocessing
Healthy, lots of
choice
Eggs Fabric Mature
Massive collection
of libraries
READABILITY
HAPPINESS /
PRODUCTIVITY
COMMUNITY /
ACTIVITY
PROPENSITY FOR
MAGIC
MATURITY /
STABILITY
HIRING
RUBY
SCALA
PYTHON
OK. Emphasis
metaprogramming can
present challenges.
High Huge and active
Metaprogramming is sometimes
abused. RoR is too magical and
many imitated its philosophy
Stable, but much
catchup remaining for
gems to support 1.9
Tough. Medium
learning curve,
hard to find
seasoned devs
Concise, expressive but
NOT simple.
Highly variable! Small and active
Too many ways to accomplish
things. Scala “implicits”
encourage magic
Language spec
changing, breakages
still occurring in dot
releases
Very difficult.
Steep learning
curve
Highly readable High Big and active Explicit better than implicit
Most mature here.
But the 2.x/3.x break
is bad.
OK. Shallow
learning curve.
FLAME BAIT
BASICS
Scala Ruby Python
23
18
8
How do they “Stack” Up?
Happify is an angel-funded consumer
destination “life game.”
HTML5, Mobile, and Facebook front ends.
Currently in stealth mode.
Score is based on:
Green = 2
Yellow = 1
Red = 0
Python
36%
Ruby
60%
Scala
4%
Github Project Relative %
Gratuitous Perf Charts!
* from: http://shootout.alioth.debian.org
pycon 2012
poster
what is happify?
‣ science of happiness
‣ positive psych trainer
‣ consumer subscription business
‣ launched in beta after 9 months
‣ ~100K users
‣ imminent public launch
FLASK NYC 2013
happify stack abbreviated biography
•FEbruary 2012: james dennis @j2labs for coffee
•march 2012: started coding poc (jinja templates only)
•june 2012: alpha poc launched
•september 2012: first real design/ux work
•october 2012: backbone/coffeescript introduced
•december 2013: redis added, closed beta launched
•march 2013: ES added, open beta launch
•june 2013: commerce, new feature set, scale up to 100K users
•august 2013: ”final” design, refactoring for public launch
•now: frontend and backend performance, press
what is large?
what is large?
•80 views
•200 templates
•60 backbone views
•50 models
•200 tests (need more!)
‣ backbone.js
‣ coffeescript
‣ haml
‣ less css
‣ flask
‣ flask-admin
‣ sqlalchemy
‣ postgres
The happify stack
‣ redis
‣ Elastic search
‣ NGINX
‣ celery
‣ gunicorn
‣ aws ec2/s3
‣ nose
‣ fabric
‣ api for mobile
‣ api for backbone
‣ backbone app bootstrapping
‣ template rendering
‣ administration ui
‣ aggregates data from postgres, redis, elasticsearch
‣ serializes context-specific object graphs
the role of flask - data switch
‣ project layout
‣ config
‣ routing setup
‣ db connection management
‣ serialization: shallow and deep
‣ FAB automation
code
‣ better config (multiple environments, config heirarchy)
‣ authentication
‣ assets pipeline
‣ model validation and serialization layer (waffling)
batteries i wish were included
batteries i could do without
‣ trailing slash redirects (but easy to control)
python 3! well, almost kinda
•flask/werkzeug support completed
•many extensions not yet
•fabric, boto, sentry ...
•too bad- unicode is a mess without it
•Handy: http://python3wos.appspot.com/
‣ flask is an excellent choice for apps like ours
‣ know what you are getting and what you aren’t, make no assumptions
‣ prepare to refactor relentlessly
‣ don’t worry that there’s no single way to do it!
conclusions
contact me:
andy parsons
andy@happify.com
@andyparsons
thank
you!

Weitere ähnliche Inhalte

Andere mochten auch

Python - Telegram
Python - TelegramPython - Telegram
Python - TelegramWidoyo PH
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...Amazon Web Services
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Samuel Adams, MBA
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale ManagementVõ Duy Tuấn
 
SF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonSF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonPaco Nathan
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...Amazon Web Services
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckJan Rezab
 
Search Content vs. Social Content
Search Content vs. Social ContentSearch Content vs. Social Content
Search Content vs. Social ContentSemrush
 

Andere mochten auch (9)

Python - Telegram
Python - TelegramPython - Telegram
Python - Telegram
 
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
TLS303 How to Deploy Python Applications on AWS Elastic Beanstalk - AWS re:In...
 
Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16Chat Bots Presentation 8.9.16
Chat Bots Presentation 8.9.16
 
Chatbot in Sale Management
Chatbot in Sale ManagementChatbot in Sale Management
Chatbot in Sale Management
 
Bot Trends 2016
Bot Trends 2016Bot Trends 2016
Bot Trends 2016
 
SF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in PythonSF Python Meetup: TextRank in Python
SF Python Meetup: TextRank in Python
 
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
AWS re:Invent 2016: Life Without SSH: Immutable Infrastructure in Production ...
 
Why Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - DeckWhy Social Media Chat Bots Are the Future of Communication - Deck
Why Social Media Chat Bots Are the Future of Communication - Deck
 
Search Content vs. Social Content
Search Content vs. Social ContentSearch Content vs. Social Content
Search Content vs. Social Content
 

Mehr von Andy Parsons

Open edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyOpen edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyAndy Parsons
 
Emotions of Startups 2014
Emotions of Startups 2014Emotions of Startups 2014
Emotions of Startups 2014Andy Parsons
 
Open Tech NYC 2013
Open Tech NYC 2013Open Tech NYC 2013
Open Tech NYC 2013Andy Parsons
 
Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Andy Parsons
 
Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Andy Parsons
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons
 

Mehr von Andy Parsons (6)

Open edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey AcademyOpen edX Conference 2014, McKinsey Academy
Open edX Conference 2014, McKinsey Academy
 
Emotions of Startups 2014
Emotions of Startups 2014Emotions of Startups 2014
Emotions of Startups 2014
 
Open Tech NYC 2013
Open Tech NYC 2013Open Tech NYC 2013
Open Tech NYC 2013
 
Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012Prince Building Tech Talk 12102012
Prince Building Tech Talk 12102012
 
Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012Ga cloud scaling 3 30-2012
Ga cloud scaling 3 30-2012
 
Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011Andy Parsons Pivotal June 2011
Andy Parsons Pivotal June 2011
 

Kürzlich hochgeladen

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024Scott Keck-Warren
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
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
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 

Kürzlich hochgeladen (20)

Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
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
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024SQL Database Design For Developers at php[tek] 2024
SQL Database Design For Developers at php[tek] 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
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
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
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
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 

Flask NYC 09262013

  • 1. FLASK! 18 months in @ happify FLASK NYC 2013 Andy Parsons @andyparsons
  • 2. This talk FLASK NYC 2013 E x p e r i e n c e a n d L e s s o n s F l a s k @ H a p p i f y A n 1 8 - m o n t h - o l d a c t i v e F l a s k c o d e b a s e H o w I g o t t o F l a s k Flask has become a VIBRANT, ACTIVE toolkit for HTTP servers. But there aren’t a lot of large examples from which to learn. LET’S CHANGE THAT.
  • 3. Me. •startup junkie. masochist. •co-founder/CTO Happify •previously CTO Outside.in, bookish, ... •MENTOR @ seedcamp, techpeaks, 500 Startups •pragmatist •love choosing tools, Learning, making them better
  • 4. not Me. •Framework zealot •django expert (no comparisons) •IDEALIST
  • 5. what is a “microframework?” •just the essentials, nothing more •extensibility through plugins •readable source •minimal magic •easy to build a toy/demo •lack of patterns for larger projects
  • 6. FLASK NYC 2013 PROJECT LINES OF CODE COMPLEXITY Backbone.js < 1000 LOW Flask (not Werkzeug) ~2000 (?) LOW Redis 100,000 MEDIUM Django 170,000 MEDIUM MongoDB 500,000 HIGH PostgreSQL > 1,000,000 HIGH! complexity spectrum * STATS FROM OHLOH (http://www.ohloh.net/) and http://www.andreas-dewes.de/code_is_beautiful/
  • 7. ‣ java/spring/.NET ‣ a FEW rails-based startups (sinatra mixed in) ‣ scala services (scalatra, play) ‣ Python a natural fit for happify (data analysis, machine learning, nlp) ‣ flask selected as toolkit my journey to flask
  • 8. A Sampling of NYC Python A Startup Junkie's Journey to Python via Java, Ruby and Scala Andy Parsons @andyparsons My Startups and Their Stacks What Are We Building? And in general... Happiness Speed Magic Readability BUSINESS WEB API SERVICES DATABASES TEAM SIZE Pro Photo ASP.NET C#, Perl SQL Server 12 Hyperlocal Content (Geolocation ) RoR Sinatra Scala PostgreSQL, MongoDB 10 Ereading and Book Recommende r RoR Scalatra Scala/Java MongoDB 8 Life Gaming Flask Python/ Gevent Python PostgreSQL, MongoDB 3 Building Happify: Comparing Language Options SPEED CONCURRENCY TOOLING PACKAGING / DEPENDENCIES DEPLOYMENT TESTING FRAMEWORKS / LIBS RUBY SCALA PYTHON Fast enough Achieved through Process.fork Healthy, lots of choice Gems Capistrano Mature Growing collection of libs, but weak in NLP Fast! Real concurrency,Akka Still early. IDE’s weak. Complex. JARs, SBT, Ivy, Maven. ? Maturing Early for native scala libraries, rely on Java interop Fast enough Achieved through multiprocessing Healthy, lots of choice Eggs Fabric Mature Massive collection of libraries READABILITY HAPPINESS / PRODUCTIVITY COMMUNITY / ACTIVITY PROPENSITY FOR MAGIC MATURITY / STABILITY HIRING RUBY SCALA PYTHON OK. Emphasis metaprogramming can present challenges. High Huge and active Metaprogramming is sometimes abused. RoR is too magical and many imitated its philosophy Stable, but much catchup remaining for gems to support 1.9 Tough. Medium learning curve, hard to find seasoned devs Concise, expressive but NOT simple. Highly variable! Small and active Too many ways to accomplish things. Scala “implicits” encourage magic Language spec changing, breakages still occurring in dot releases Very difficult. Steep learning curve Highly readable High Big and active Explicit better than implicit Most mature here. But the 2.x/3.x break is bad. OK. Shallow learning curve. FLAME BAIT BASICS Scala Ruby Python 23 18 8 How do they “Stack” Up? Happify is an angel-funded consumer destination “life game.” HTML5, Mobile, and Facebook front ends. Currently in stealth mode. Score is based on: Green = 2 Yellow = 1 Red = 0 Python 36% Ruby 60% Scala 4% Github Project Relative % Gratuitous Perf Charts! * from: http://shootout.alioth.debian.org pycon 2012 poster
  • 9. what is happify? ‣ science of happiness ‣ positive psych trainer ‣ consumer subscription business ‣ launched in beta after 9 months ‣ ~100K users ‣ imminent public launch FLASK NYC 2013
  • 10. happify stack abbreviated biography •FEbruary 2012: james dennis @j2labs for coffee •march 2012: started coding poc (jinja templates only) •june 2012: alpha poc launched •september 2012: first real design/ux work •october 2012: backbone/coffeescript introduced •december 2013: redis added, closed beta launched •march 2013: ES added, open beta launch •june 2013: commerce, new feature set, scale up to 100K users •august 2013: ”final” design, refactoring for public launch •now: frontend and backend performance, press
  • 12. what is large? •80 views •200 templates •60 backbone views •50 models •200 tests (need more!)
  • 13. ‣ backbone.js ‣ coffeescript ‣ haml ‣ less css ‣ flask ‣ flask-admin ‣ sqlalchemy ‣ postgres The happify stack ‣ redis ‣ Elastic search ‣ NGINX ‣ celery ‣ gunicorn ‣ aws ec2/s3 ‣ nose ‣ fabric
  • 14. ‣ api for mobile ‣ api for backbone ‣ backbone app bootstrapping ‣ template rendering ‣ administration ui ‣ aggregates data from postgres, redis, elasticsearch ‣ serializes context-specific object graphs the role of flask - data switch
  • 15. ‣ project layout ‣ config ‣ routing setup ‣ db connection management ‣ serialization: shallow and deep ‣ FAB automation code
  • 16. ‣ better config (multiple environments, config heirarchy) ‣ authentication ‣ assets pipeline ‣ model validation and serialization layer (waffling) batteries i wish were included batteries i could do without ‣ trailing slash redirects (but easy to control)
  • 17. python 3! well, almost kinda •flask/werkzeug support completed •many extensions not yet •fabric, boto, sentry ... •too bad- unicode is a mess without it •Handy: http://python3wos.appspot.com/
  • 18. ‣ flask is an excellent choice for apps like ours ‣ know what you are getting and what you aren’t, make no assumptions ‣ prepare to refactor relentlessly ‣ don’t worry that there’s no single way to do it! conclusions