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.3k
"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
710
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
530
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
690
Smart Dumpster by Bradley E. Angell
pycon2014
0
500
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
710
Featured
See All Featured
Unsuck your backbone
ammeep
669
57k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
550
What's in a price? How to price your products and services
michaelherold
244
12k
Building a Modern Day E-commerce SEO Strategy
aleyda
38
7k
RailsConf & Balkan Ruby 2019: The Past, Present, and Future of Rails at GitHub
eileencodes
132
33k
Side Projects
sachag
452
42k
BBQ
matthewcrist
85
9.4k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Templates, Plugins, & Blocks: Oh My! Creating the theme that thinks of everything
marktimemedia
28
2.2k
Documentation Writing (for coders)
carmenintech
67
4.5k
Distributed Sagas: A Protocol for Coordinating Microservices
caitiem20
330
21k
Fashionably flexible responsive web design (full day workshop)
malarkey
406
66k
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?