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.6k
Farewell and Welcome Home, Python in Two Genders by Naomi_Ceder
pycon2014
1
740
Deliver Your Software in an Envelope by Augie Fackler and Nathaniel Manista
pycon2014
1
550
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
700
Smart Dumpster by Bradley E. Angell
pycon2014
0
530
Software Engineering for Hackers: Bridging the Two Solitudes by Tavish Armstrong
pycon2014
0
740
Featured
See All Featured
KATA
mclloyd
29
14k
A Tale of Four Properties
chriscoyier
159
23k
Fireside Chat
paigeccino
37
3.5k
Optimizing for Happiness
mojombo
379
70k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
34
3k
Stop Working from a Prison Cell
hatefulcrawdad
269
20k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
52
2.8k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
231
53k
Dealing with People You Can't Stand - Big Design 2015
cassininazir
367
26k
The MySQL Ecosystem @ GitHub 2015
samlambert
251
13k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
10
910
Code Review Best Practice
trishagee
68
18k
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?