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.1k
Localization Revisted (aka. Translations Evolved) by Ruchi Varshney
pycon2014
0
670
Smart Dumpster by Bradley E. Angell
pycon2014
0
480
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
700
Featured
See All Featured
Principles of Awesome APIs and How to Build Them.
keavy
125
16k
Six Lessons from altMBA
skipperchong
26
3.3k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
248
20k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Writing Fast Ruby
sferik
623
60k
Visualizing Your Data: Incorporating Mongo into Loggly Infrastructure
mongodb
38
9.1k
No one is an island. Learnings from fostering a developers community.
thoeni
18
2.9k
Clear Off the Table
cherdarchuk
91
320k
The Invisible Side of Design
smashingmag
295
50k
Raft: Consensus for Rubyists
vanstee
135
6.5k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
226
52k
Done Done
chrislema
180
16k
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?