Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Upgrade your Web Development Toolchain by Blais...
Search
PyCon 2014
April 12, 2014
3
1.1k
Upgrade your Web Development Toolchain by Blaise Laflamme
PyCon 2014
April 12, 2014
Tweet
Share
More Decks by PyCon 2014
See All by PyCon 2014
Postgres Performance for Humans by Craig Kerstiens
pycon2014
29
3.6k
Technical Onboarding, Training, and Mentoring by Kate Heddleston and Nicole Zuckerman
pycon2014
1
2.2k
"My big gay adventure. Making, releasing and selling an indie game made in python." by Luke Miller
pycon2014
2
1.5k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
700
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
520
Hitchhikers Guide to Free and Open Source Participation by Elena Williams
pycon2014
6
1.2k
Localization Revisted (aka. Translations Evolved) by Ruchi Varshney
pycon2014
0
680
Smart Dumpster by Bradley E. Angell
pycon2014
0
490
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
710
Featured
See All Featured
Being A Developer After 40
akosma
86
590k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
93
16k
How STYLIGHT went responsive
nonsquared
95
5.2k
Designing for Performance
lara
604
68k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
A Tale of Four Properties
chriscoyier
156
23k
Thoughts on Productivity
jonyablonski
67
4.3k
Designing on Purpose - Digital PM Summit 2013
jponch
115
7k
Reflections from 52 weeks, 52 projects
jeffersonlam
346
20k
How to Think Like a Performance Engineer
csswizardry
20
1.1k
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Rebuilding a faster, lazier Slack
samanthasiow
79
8.7k
Transcript
Upgrade your Web Development Toolchain Blaise Laflamme Pycon 2014
About Me • Full-Stack Web Development • Lead Projects •
Lead Teams • Still learning a lot everyday
What This Talk is About • Ideas and patterns •
Combining tools • Working with people on projects
What This Talk is not About • Strong opinions •
Cookbook recipes • In-depth technical examples
Best Practices & Patterns • Dogmatism is never a good
thing • Should always have a significant benefit • Stick to what really makes a difference
Problems to Solve • Tie up multiple in-development projects •
Tie up multiple environments & tools • Mix up development teams
Point Of View • Separation of concerns • Use known
tools • Adapt to context
What will people do if You die!
Project Workflow • Server provisioning & setup • WebApp development
• Application deployment
Provisioning & Deployment • Developer’s machine • Dedicated, Linode, Rackspace,
Heroku, … • Ansible, Saltstack, Chef, Puppet, Docker, …
We should not care
They should call you in their process
App Environment should be self-contained
Running on multiple platforms and environments provides a better tested
and robust codebase
WebApp Development • Back end • Python, frameworks, template engines,
… • Front end • HTML, CSS, Javascript, frameworks, …
They have both developed their own expertise, tools and workflows
Package Management Back end Package Management $ easy_install pyramid $
easy_install pyramid==1.5 $ pip install pyramid $ pip install pyramid==1.5 Front end Package Management $ bower install jquery $ bower install jquery#1.11.0
Package Management Back end Package Management setup( name='myproject', version=0.1.0, install_requires=[‘pyramid==1.5’]
) Front end Package Management { "name": "myproject-resources", "version": "0.1.0", "dependencies": { "jquery": “1.11.0” } }
What is Bower? A package manager for the web
Assets Management Back end Assets Management from webassets import Bundle
all_js = Bundle( Bundle('common/libs/jquery/jquery.js'), filters='jsmin', output='gen/packed.js' ) >>> env['all_js'].urls() ('/media/gen/packed.js',)
Assets Management Front end Assets Management module.exports = function (grunt)
{ grunt.initConfig({ jsmin-sourcemap: { dist: { src: 'common/libs/jquery/jquery.js', dest: 'gen/packed.js' } }, }); grunt.loadNpmTasks('grunt-jsmin-sourcemap'); grunt.registerTask('dist', [ 'jsmin-sourcemap:dist' ]); };
What is Grunt? A task runner for automation
Frontend also need • Some sort of include/import/require • Ability
to load nested dependencies
Frontend also need Front end dependencies and requirements require.config({ paths:
{ jquery: 'libs/jquery-1.11.0' } }); … require( ['jquery'], function( $ ) { });
Why would you want frontend to rely on backend dependancy?
You reach a point of separation • Advanced hybrid-application •
SPA (Single Page App) • Backend as an API
You’ll benefit from splitting to multiple projects • One project
per team or «concerns» • Use same global app or project environment • Share common set of tools and patterns
Buildout • Application-centric • For assembly and deployment • Make
assembly of programs repeatable
Buildout • Uses extendable configuration files • Uses extensions •
Uses recipes
Buildout [buildout] extensions = mr.developer extends = https://raw.github.com/reebalazs/ buildout.javascript.yeoman/master/yeoman.cfg parts+
= dirs eggs bower_modules develop = src/myapp1 src/myapp2 ! [dirs] recipe = z3c.recipe.mkdir paths = var
Buildout [sources] myapp1 = git
[email protected]
:blaflamme/myapp1.git myapp2 = git
[email protected]
:blaflamme/myapp2.git
! [eggs] recipe = zc.recipe.egg dependent-scripts = true eggs = appenlight-client myapp1 myapp2 interpreter = py
Provide a development project that builds the application environment
myapp-dev project . ├── Gruntfile.js ├── Makefile ├── bootstrap.py ├──
bower.json ├── buildout.cfg ├── etc └── package.json
Buildout Project Setting the project $ git clone
[email protected]
:blaflamme/myapp-dev.git $
cd myapp-dev $ virtualenv . $ bin/python bootstrap.py $ bin/buildout
You’re done!
myapp-dev project . ├── Gruntfile.js ├── Makefile ├── bin ├──
bootstrap.py ├── bower.json ├── buildout.cfg ├── components ├── develop-eggs ├── eggs ├── etc ├── include ├── lib ├── node_modules ├── package.json ├── parts ├── src └── var
Command Line API • Wrap multiple commands under simpler API
• Use Makefiles, Make is a good tool for this ;)
Makefile HERE = $(shell pwd) BIN = $(HERE)/bin VIRTUALENV =
virtualenv PYTHON = $(HERE)/bin/python virtualenv: $(VIRTUALENV) . bootstrap: $(PYTHON) bootstrap.py buildout: $(BIN)/buildout setup: virtualenv bootstrap buildout
Makefile $ git clone
[email protected]
:blaflamme/myapp-dev.git $ cd myapp-dev $ make
setup
Conclusion • Isolate Application Environment • Organize projects in a
flexible way • Give more power to user & team
Questions?