• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
Flask NYC 09262013
 

Flask NYC 09262013

on

  • 1,496 views

Presentation at the Flask NYC Meetup, Sept 2013

Presentation at the Flask NYC Meetup, Sept 2013

Statistics

Views

Total Views
1,496
Views on SlideShare
1,478
Embed Views
18

Actions

Likes
0
Downloads
5
Comments
0

2 Embeds 18

https://www.linkedin.com 11
http://www.linkedin.com 7

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    Flask NYC 09262013 Flask NYC 09262013 Presentation Transcript

    • 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!