SlideShare una empresa de Scribd logo
1 de 77
Descargar para leer sin conexión
Code Quality to Monitoring production: 
use cases and best practices 
David Melamed 
Pyweb meetup - September 21, 2014
Agenda 
What is good code? 
How to measure quality code? 
Continuous Integration 
How to efficiently monitor production?
About me 
Full-stack developer at Cloudlock 
Fond of technology & automation 
Code Quality Evangelist 
Geek on my free time
About Cloudlock 
Founded: 2011 
Headquarters: Waltham, Mass. (U.S.) 
R&D Headquarters: Tel Aviv 
Employees: 80+ 
Funding: $28M+ 
Investors Selected customers 
700+ Customers 9,600 Unique 
Apps Discovered 
Native Cloud Security Solutions 
for SaaS Applications 
5 million Users 
under Management 
13 billion objects 
processed daily
What is good code?
Good code is… 
Easy to read & understand 
Easy to extend 
Easy to maintain 
Testable
How to write good code?
from xkcd
Good code requires constant 
REFACTORING
The Code Quality Star 
Coding 
Standards 
Code 
Review 
Automated 
Tests 
Code 
Complexity 
Architecture 
Design 
Source
Code should be easy to read
Code should be readable 
Avoid comments but avoid obvious ones (the code 
should be self-explanatory) 
Avoid comments too verbose 
Comments need to be maintained
Coding Standards
The Zen of Python (PEP20) 
Beautiful is better than ugly 
Explicit is better than implicit 
Simple is better than complex 
Complex is better than complicated 
Readability counts
Coding Style: Readability Counts 
“Programs must be written for people to read, and 
only incidentally for machines to execute.” 
Abelson & Sussman, Structure and Interpretation of Computer Programs
PEP8: Style guide for Python 
Indentation 
Maximum line length 
Blank lines 
Redundant white spaces 
Imports 
Comments 
Naming conventions 
…
How to check /enforce PEP8 
Pycharm (Tools > Flake8) 
Git pre-commit hook (http://goo.gl/bteYkq) 
Jenkins job for continuous integration
Naming is key
Naming best practises 
Adopt a convention and stick with it (fetch vs. retrieve vs. get) 
Use intention-revealing names 
Avoid misleading readers 
Make meaningful distinctions 
Use searchable names 
Avoid mental mapping 
Use domain names 
From Clean code, R. Martin
Code Architecture
Best Practices in Code Architecture 
OOP 
DRY 
SOLID 
Loose Coupling
Don’t Repeat Yourself (aka DRY) 
http://www.sonarqube.org/manage-duplicated-code-with-sonar/
SOLID principles 
• SRP: Single Responsibility Principle 
• OCP: Open/closed principle 
• LSP: Liskov substitution principle 
• ISP: Interface segregation principle 
• DIP: dependency inversion 
principle
http://www.codeproject.com/Articles/93369/How-I-explained-OOD-to-my-wife
http://www.codeproject.com/Articles/93369/How-I-explained-OOD-to-my-wife
http://www.codeproject.com/Articles/93369/How-I-explained-OOD-to-my-wife
http://www.codeproject.com/Articles/93369/How-I-explained-OOD-to-my-wife
http://www.codeproject.com/Articles/93369/How-I-explained-OOD-to-my-wife
Loosely Coupled Components
Main principles 
Split components into repositories 
Web app: use clean layers 
view / endpoint (presentation) 
service (business logic) 
DAO (model) 
Use message bus for communication inter-components (i.e. RabbitMQ) 
Use daemons / workers for long-running tasks 
Use events / signals to decouple unrelated actions 
Microservices
Architecture at Cloudlock 
Nginx 
AWS VPC 
Web 
Server 
API 
Server 
Message Bus (RabbitMQ) 
RDS 
PostgreSQL 
ElastiCache 
Redis 
Authentication Gateway 
Worker Worker Worker 
Logs
Code Reviews
Tools for code review 
Github Pull Requests 
Review Board 
Gerrit 
Crucible
Code documentation
Code Testing
Different types of tests 
Manual Test 
Unit Test 
Integration Test 
System Test 
Acceptance/Regression Test (end-to-end) 
Smoke Test
Unit Test 
Test if small, distinct and isolated portions of code 
are working as expected, provided some input 
Mock your dependencies (database, logger, service) 
Should be very fast 
No need to test EVERYTHING (i.e. private methods) 
Frameworks: unittest, pytest and nose
Pytest 
No need for base class (works both for classes and methods) 
More pythonic than unittest 
Fixtures (conftest.py) 
Parametrized tests 
Markers 
Various plugins for coverage, bdd, django, twisted… 
Used for unit tests, integration tests and end to end tests
Integration Tests 
Test communication between services 
You may mock some of the dependencies depending on 
what you test
System Tests 
Global test, more functional of the whole system 
TestApp (Pyramid app) using a test database 
Call the API and test the expected response code
End-to-end tests 
Splinter: web driver abstraction (firefox, selenium) 
splinter-pytest: fixtures for browser 
Plugin for rerun flaky tests, tests with steps 
Use Selenium Grid to test several browsers
Smoke Tests 
Make sure the system is alive 
Tests that the components are working 
Tests that the components can communicate 
Health check / status page
Measuring code quality
Code Quality Metrics 
Code Standards Violations (pylint /flake8/pyflakes) 
LOC (Lines Of Code) 
Cyclomatic Complexity 
Unit Tests Coverage
Code Coverage 
Makes sense only for unit tests 
Calculates the coverage based on the paths run by 
the tests 
100% coverage is not a goal on its own 
May be misleading regarding the code quality
Unit Test Diff Coverage
Mutation Analysis 
From Mutation analysis vs. code coverage in automated assessment 
of students’ Testing Skills (P. Ihantola)
Pylint 
Report 
====== 
85 statements analysed. ! 
Duplication 
----------- ! 
+-------------------------+------+---------+-----------+ 
| |now |previous |difference | 
+=========================+======+=========+===========+ 
|nb duplicated lines |0 |0 |= | 
+-------------------------+------+---------+-----------+ 
|percent duplicated lines |0.000 |0.000 |= | 
+-------------------------+------+---------+-----------+ !!! 
Messages by category 
-------------------- ! 
+-----------+-------+---------+-----------+ 
|type |number |previous |difference | 
+===========+=======+=========+===========+ 
|convention |18 |18 |= | 
+-----------+-------+---------+-----------+ 
|refactor |2 |2 |= | 
+-----------+-------+---------+-----------+ 
|warning |1 |1 |= | 
+-----------+-------+---------+-----------+ 
|error |4 |4 |= | 
+-----------+-------+---------+-----------+ !!! 
Messages 
-------- ! 
+-----------------------------+------------+ 
|message id |occurrences | 
+=============================+============+ 
|line-too-long |10 | 
+-----------------------------+------------+ 
|no-name-in-module |4 | 
+-----------------------------+------------+ 
|missing-docstring |4 | 
+-----------------------------+------------+ 
Global evaluation 
----------------- 
Your code has been rated at 5.18/10 (previous run: 5.18/10, +0.00) ! 
Raw metrics 
----------- ! 
+----------+-------+------+---------+-----------+ 
|type |number |% |previous |difference | 
+==========+=======+======+=========+===========+ 
|code |90 |63.83 |90 |= | 
+----------+-------+------+---------+-----------+ 
|docstring |30 |21.28 |30 |= | 
+----------+-------+------+---------+-----------+ 
|comment |5 |3.55 |5 |= | 
+----------+-------+------+---------+-----------+ 
|empty |16 |11.35 |16 |= | 
+----------+-------+------+---------+-----------+ !!! 
Statistics by type 
------------------ ! 
+---------+-------+-----------+-----------+------------+---------+ 
|type |number |old number |difference |%documented |%badname | 
+=========+=======+===========+===========+============+=========+ 
|module |1 |1 |= |0.00 |0.00 | 
+---------+-------+-----------+-----------+------------+---------+ 
|class |2 |2 |= |100.00 |0.00 | 
+---------+-------+-----------+-----------+------------+---------+ 
|method |1 |1 |= |100.00 |0.00 | 
+---------+-------+-----------+-----------+------------+---------+ 
|function |6 |6 |= |50.00 |33.33 | 
+————+-------+-----------+-----------+------------+---------+ !!!!!!!!!!
Test Automation
Why do you need automated tests? 
! 
Optimise speed, efficiency and quality 
Catch the bugs upfront 
Safety net for refactoring
On the Road to 
Continuous Integration
Several “Continuous” processes 
Continuous Integration 
Continuous Deployment 
Continuous Delivery
Several platforms for CI 
Jenkins 
Travis CI 
Circle CI 
Shippable 
BuildBot
Continuous Integration Flow 
Feature Branch 
Develop Branch 
Git Push 
Updates 
Github PR 
Several jobs: 
- pep8 compliance 
- unit test 
- integration test 
- end to end test 
Merge PR 
Pull Request 
Tag 
Deployment 
Code Review
Jenkins dashboard
Automated Deployment
Pick the right tool to deploy 
AWS ElasticBeanstalk 
AWS OpsWorks 
Chef 
Puppet 
SaltStack 
Ansible
Ansible 
http://terry.im/wiki/terry/attachments/29786135/37552129.png
It works only on my machine
The Docker Project 
Run everywhere 
Run everything 
Advantages: 
• Pricing 
• Speed 
• Unifying environments 
• Testability / reproducibility 
• Easily add/replace components
Docker on your Mac 
http://www.warski.org/blog/2014/05/spray-server-docker-container/docker-stack-5/
Production Monitoring
Production Monitoring 
AWS CloudWatch 
End-to-end tests running in Jenkins 
StackDriver 
Log analysis (streams)
Questions?
Python developers WANTED 
Contact: dmelamed@cloudlock.com

Más contenido relacionado

La actualidad más candente

Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practicesmh_azad
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoftMichaela Greiler
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundationKevlin Henney
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming pptismailmrribi
 
Kill the mutants - A better way to test your tests
Kill the mutants - A better way to test your testsKill the mutants - A better way to test your tests
Kill the mutants - A better way to test your testsRoy van Rijn
 
DevOps to DevSecOps Journey..
DevOps to DevSecOps Journey..DevOps to DevSecOps Journey..
DevOps to DevSecOps Journey..Siddharth Joshi
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 
Lecture 02 lexical analysis
Lecture 02 lexical analysisLecture 02 lexical analysis
Lecture 02 lexical analysisIffat Anjum
 
Lecture 04 syntax analysis
Lecture 04 syntax analysisLecture 04 syntax analysis
Lecture 04 syntax analysisIffat Anjum
 
Unit Testing in Python
Unit Testing in PythonUnit Testing in Python
Unit Testing in PythonHaim Michael
 
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)Paige Bailey
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#Dr.Neeraj Kumar Pandey
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelinesAnkur Goyal
 
Security Process in DevSecOps
Security Process in DevSecOpsSecurity Process in DevSecOps
Security Process in DevSecOpsOpsta
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytestHector Canto
 

La actualidad más candente (20)

Coding Best Practices
Coding Best PracticesCoding Best Practices
Coding Best Practices
 
On to code review lessons learned at microsoft
On to code review lessons learned at microsoftOn to code review lessons learned at microsoft
On to code review lessons learned at microsoft
 
Python Advanced – Building on the foundation
Python Advanced – Building on the foundationPython Advanced – Building on the foundation
Python Advanced – Building on the foundation
 
Python Programming ppt
Python Programming pptPython Programming ppt
Python Programming ppt
 
Kill the mutants - A better way to test your tests
Kill the mutants - A better way to test your testsKill the mutants - A better way to test your tests
Kill the mutants - A better way to test your tests
 
DevOps to DevSecOps Journey..
DevOps to DevSecOps Journey..DevOps to DevSecOps Journey..
DevOps to DevSecOps Journey..
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Unit testing with JUnit
Unit testing with JUnitUnit testing with JUnit
Unit testing with JUnit
 
Lecture 02 lexical analysis
Lecture 02 lexical analysisLecture 02 lexical analysis
Lecture 02 lexical analysis
 
Modern Python Testing
Modern Python TestingModern Python Testing
Modern Python Testing
 
Lecture 04 syntax analysis
Lecture 04 syntax analysisLecture 04 syntax analysis
Lecture 04 syntax analysis
 
Operators in python
Operators in pythonOperators in python
Operators in python
 
Unit Testing in Python
Unit Testing in PythonUnit Testing in Python
Unit Testing in Python
 
Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)Python 101: Python for Absolute Beginners (PyTexas 2014)
Python 101: Python for Absolute Beginners (PyTexas 2014)
 
Introduction to c#
Introduction to c#Introduction to c#
Introduction to c#
 
C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#C# lecture 2: Literals , Variables and Data Types in C#
C# lecture 2: Literals , Variables and Data Types in C#
 
Software development best practices & coding guidelines
Software development best practices & coding guidelinesSoftware development best practices & coding guidelines
Software development best practices & coding guidelines
 
Security Process in DevSecOps
Security Process in DevSecOpsSecurity Process in DevSecOps
Security Process in DevSecOps
 
DevSecOps 101
DevSecOps 101DevSecOps 101
DevSecOps 101
 
Effective testing with pytest
Effective testing with pytestEffective testing with pytest
Effective testing with pytest
 

Destacado

Python code profiling - Jackson Isaac
Python code profiling - Jackson IsaacPython code profiling - Jackson Isaac
Python code profiling - Jackson IsaacJackson Isaac
 
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستان
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستاندليل الخير لمشاريع النجاة الخيرية في جمهورية باكستان
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستانجمعية النجاة الخيرية
 
Vintage macintosh computing
Vintage macintosh computingVintage macintosh computing
Vintage macintosh computingJoel Gerdeen
 
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...Benito Medina
 
Presentatie Digitale transformatie in de zorg
Presentatie Digitale transformatie in de zorgPresentatie Digitale transformatie in de zorg
Presentatie Digitale transformatie in de zorgMartijn van Kooij
 
Final status of RTI dated 26.03.2017 against SC
Final status of RTI dated 26.03.2017 against SCFinal status of RTI dated 26.03.2017 against SC
Final status of RTI dated 26.03.2017 against SCOm Prakash Poddar
 
TheRealFRANKYhollywood
TheRealFRANKYhollywoodTheRealFRANKYhollywood
TheRealFRANKYhollywoodiammkstevens
 
Buscamos ser socios estratégicos del cliente
Buscamos ser socios estratégicos del clienteBuscamos ser socios estratégicos del cliente
Buscamos ser socios estratégicos del clienteLLYC
 
Conferencia "No te va a gustar lo que te voy decir"
Conferencia "No te va a gustar lo que te voy decir"Conferencia "No te va a gustar lo que te voy decir"
Conferencia "No te va a gustar lo que te voy decir"Walterman
 
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebooku
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebookuNMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebooku
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebookuNew Media Inspiration
 
Los ciberriesgos y su transferencia al sector asegurador
Los ciberriesgos y su transferencia al sector aseguradorLos ciberriesgos y su transferencia al sector asegurador
Los ciberriesgos y su transferencia al sector aseguradorNunkyworld
 
How to Containerize WebSphere Application Server Traditional, and Why You Mig...
How to Containerize WebSphere Application Server Traditional, and Why You Mig...How to Containerize WebSphere Application Server Traditional, and Why You Mig...
How to Containerize WebSphere Application Server Traditional, and Why You Mig...David Currie
 
What is Register Registrable of Controller and Nominee Director
What is Register Registrable of Controller and Nominee DirectorWhat is Register Registrable of Controller and Nominee Director
What is Register Registrable of Controller and Nominee DirectorMichelle Lai
 
Head Start Online: A Good Start is Half the Work
Head Start Online: A Good Start is Half the WorkHead Start Online: A Good Start is Half the Work
Head Start Online: A Good Start is Half the WorkMark Brown
 
Mapa experiencias colaboración fap of
Mapa experiencias colaboración fap ofMapa experiencias colaboración fap of
Mapa experiencias colaboración fap ofRita Puig Soler
 
9 zabójczych praktyk za które mi podziękujesz (polish)
9 zabójczych praktyk za które mi podziękujesz (polish)9 zabójczych praktyk za które mi podziękujesz (polish)
9 zabójczych praktyk za które mi podziękujesz (polish)Krzysztof Piwowar
 
Ias2017 tamingtheenterprise
Ias2017 tamingtheenterpriseIas2017 tamingtheenterprise
Ias2017 tamingtheenterpriseKaren VanHouten
 
Representacion de la realidad: de lo literal a la abstraccion
Representacion de la realidad: de lo literal a la abstraccionRepresentacion de la realidad: de lo literal a la abstraccion
Representacion de la realidad: de lo literal a la abstraccionIván Castiblanco Ramírez
 

Destacado (20)

Python code profiling - Jackson Isaac
Python code profiling - Jackson IsaacPython code profiling - Jackson Isaac
Python code profiling - Jackson Isaac
 
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستان
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستاندليل الخير لمشاريع النجاة الخيرية في جمهورية باكستان
دليل الخير لمشاريع النجاة الخيرية في جمهورية باكستان
 
Vintage macintosh computing
Vintage macintosh computingVintage macintosh computing
Vintage macintosh computing
 
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...
Revista Yunke nº5 Órgano de Expresión de la Sección Sindical del S.A.T. en...
 
Presentatie Digitale transformatie in de zorg
Presentatie Digitale transformatie in de zorgPresentatie Digitale transformatie in de zorg
Presentatie Digitale transformatie in de zorg
 
Final status of RTI dated 26.03.2017 against SC
Final status of RTI dated 26.03.2017 against SCFinal status of RTI dated 26.03.2017 against SC
Final status of RTI dated 26.03.2017 against SC
 
TheRealFRANKYhollywood
TheRealFRANKYhollywoodTheRealFRANKYhollywood
TheRealFRANKYhollywood
 
Buscamos ser socios estratégicos del cliente
Buscamos ser socios estratégicos del clienteBuscamos ser socios estratégicos del cliente
Buscamos ser socios estratégicos del cliente
 
Conferencia "No te va a gustar lo que te voy decir"
Conferencia "No te va a gustar lo que te voy decir"Conferencia "No te va a gustar lo que te voy decir"
Conferencia "No te va a gustar lo que te voy decir"
 
Vikingos
VikingosVikingos
Vikingos
 
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebooku
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebookuNMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebooku
NMI13 Marek Prchal - prvních 10 věcí, které dělám, když je problém na facebooku
 
Los ciberriesgos y su transferencia al sector asegurador
Los ciberriesgos y su transferencia al sector aseguradorLos ciberriesgos y su transferencia al sector asegurador
Los ciberriesgos y su transferencia al sector asegurador
 
How to Containerize WebSphere Application Server Traditional, and Why You Mig...
How to Containerize WebSphere Application Server Traditional, and Why You Mig...How to Containerize WebSphere Application Server Traditional, and Why You Mig...
How to Containerize WebSphere Application Server Traditional, and Why You Mig...
 
What is Register Registrable of Controller and Nominee Director
What is Register Registrable of Controller and Nominee DirectorWhat is Register Registrable of Controller and Nominee Director
What is Register Registrable of Controller and Nominee Director
 
Head Start Online: A Good Start is Half the Work
Head Start Online: A Good Start is Half the WorkHead Start Online: A Good Start is Half the Work
Head Start Online: A Good Start is Half the Work
 
Mapa experiencias colaboración fap of
Mapa experiencias colaboración fap ofMapa experiencias colaboración fap of
Mapa experiencias colaboración fap of
 
9 zabójczych praktyk za które mi podziękujesz (polish)
9 zabójczych praktyk za które mi podziękujesz (polish)9 zabójczych praktyk za które mi podziękujesz (polish)
9 zabójczych praktyk za które mi podziękujesz (polish)
 
RESEÑA HISTÓRICA DE LA INSTRUCCIÓN PREMILITAR (IPM) EN VENEZUELA
RESEÑA HISTÓRICA DE LA INSTRUCCIÓN PREMILITAR (IPM) EN VENEZUELARESEÑA HISTÓRICA DE LA INSTRUCCIÓN PREMILITAR (IPM) EN VENEZUELA
RESEÑA HISTÓRICA DE LA INSTRUCCIÓN PREMILITAR (IPM) EN VENEZUELA
 
Ias2017 tamingtheenterprise
Ias2017 tamingtheenterpriseIas2017 tamingtheenterprise
Ias2017 tamingtheenterprise
 
Representacion de la realidad: de lo literal a la abstraccion
Representacion de la realidad: de lo literal a la abstraccionRepresentacion de la realidad: de lo literal a la abstraccion
Representacion de la realidad: de lo literal a la abstraccion
 

Similar a Python - code quality and production monitoring

SF1 - Apex Development Best Practises
SF1 - Apex Development Best PractisesSF1 - Apex Development Best Practises
SF1 - Apex Development Best PractisesSebastian Wagner
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis Engineering Software Lab
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review ProcessDr. Syed Hassan Amin
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Codeerikmsp
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software DevelopmentJignesh Patel
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixJustin Basilico
 
Guidelines to Measuring Test Automation ROI
 Guidelines to Measuring Test Automation ROI Guidelines to Measuring Test Automation ROI
Guidelines to Measuring Test Automation ROIPerfecto by Perforce
 
Neotys PAC 2018 - Tingting Zong
Neotys PAC 2018 - Tingting ZongNeotys PAC 2018 - Tingting Zong
Neotys PAC 2018 - Tingting ZongNeotys_Partner
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsLinards Liep
 
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...MLconf
 
Accelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAccelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAmazon Web Services
 
Recommendations for Building Machine Learning Software
Recommendations for Building Machine Learning SoftwareRecommendations for Building Machine Learning Software
Recommendations for Building Machine Learning SoftwareJustin Basilico
 
Creating a successful continuous testing environment by Eran Kinsbruner
Creating a successful continuous testing environment by Eran KinsbrunerCreating a successful continuous testing environment by Eran Kinsbruner
Creating a successful continuous testing environment by Eran KinsbrunerQA or the Highway
 
Track c how do we break - jasper
Track c   how do we break - jasperTrack c   how do we break - jasper
Track c how do we break - jasperchiportal
 
Framework For Automation Testing Practice Sharing
Framework For Automation Testing Practice SharingFramework For Automation Testing Practice Sharing
Framework For Automation Testing Practice SharingKMS Technology
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation ArchitectureErdem YILDIRIM
 
Designing for Testability - Rohit Nayak
Designing for Testability - Rohit NayakDesigning for Testability - Rohit Nayak
Designing for Testability - Rohit NayakIndicThreads
 

Similar a Python - code quality and production monitoring (20)

Code Quality Analysis
Code Quality AnalysisCode Quality Analysis
Code Quality Analysis
 
SF1 - Apex Development Best Practises
SF1 - Apex Development Best PractisesSF1 - Apex Development Best Practises
SF1 - Apex Development Best Practises
 
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
Parasoft .TEST, Write better C# Code Using  Data Flow Analysis Parasoft .TEST, Write better C# Code Using  Data Flow Analysis
Parasoft .TEST, Write better C# Code Using Data Flow Analysis
 
Improving Code Quality Through Effective Review Process
Improving Code Quality Through Effective  Review ProcessImproving Code Quality Through Effective  Review Process
Improving Code Quality Through Effective Review Process
 
Working Effectively With Legacy Perl Code
Working Effectively With Legacy Perl CodeWorking Effectively With Legacy Perl Code
Working Effectively With Legacy Perl Code
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software Development
 
Lessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at NetflixLessons Learned from Building Machine Learning Software at Netflix
Lessons Learned from Building Machine Learning Software at Netflix
 
Guidelines to Measuring Test Automation ROI
 Guidelines to Measuring Test Automation ROI Guidelines to Measuring Test Automation ROI
Guidelines to Measuring Test Automation ROI
 
Neotys PAC 2018 - Tingting Zong
Neotys PAC 2018 - Tingting ZongNeotys PAC 2018 - Tingting Zong
Neotys PAC 2018 - Tingting Zong
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepins
 
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...
Justin Basilico, Research/ Engineering Manager at Netflix at MLconf SF - 11/1...
 
Accelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and MicroservicesAccelerate your Application Delivery with DevOps and Microservices
Accelerate your Application Delivery with DevOps and Microservices
 
Recommendations for Building Machine Learning Software
Recommendations for Building Machine Learning SoftwareRecommendations for Building Machine Learning Software
Recommendations for Building Machine Learning Software
 
Creating a successful continuous testing environment by Eran Kinsbruner
Creating a successful continuous testing environment by Eran KinsbrunerCreating a successful continuous testing environment by Eran Kinsbruner
Creating a successful continuous testing environment by Eran Kinsbruner
 
Track c how do we break - jasper
Track c   how do we break - jasperTrack c   how do we break - jasper
Track c how do we break - jasper
 
Framework For Automation Testing Practice Sharing
Framework For Automation Testing Practice SharingFramework For Automation Testing Practice Sharing
Framework For Automation Testing Practice Sharing
 
6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture6 Traits of a Successful Test Automation Architecture
6 Traits of a Successful Test Automation Architecture
 
Guia de Estudo OCA Java SE 5 - SE6
Guia de Estudo OCA Java SE 5 - SE6Guia de Estudo OCA Java SE 5 - SE6
Guia de Estudo OCA Java SE 5 - SE6
 
Designing for Testability - Rohit Nayak
Designing for Testability - Rohit NayakDesigning for Testability - Rohit Nayak
Designing for Testability - Rohit Nayak
 

Último

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 

Último (20)

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 

Python - code quality and production monitoring

  • 1. Code Quality to Monitoring production: use cases and best practices David Melamed Pyweb meetup - September 21, 2014
  • 2. Agenda What is good code? How to measure quality code? Continuous Integration How to efficiently monitor production?
  • 3. About me Full-stack developer at Cloudlock Fond of technology & automation Code Quality Evangelist Geek on my free time
  • 4. About Cloudlock Founded: 2011 Headquarters: Waltham, Mass. (U.S.) R&D Headquarters: Tel Aviv Employees: 80+ Funding: $28M+ Investors Selected customers 700+ Customers 9,600 Unique Apps Discovered Native Cloud Security Solutions for SaaS Applications 5 million Users under Management 13 billion objects processed daily
  • 5. What is good code?
  • 6. Good code is… Easy to read & understand Easy to extend Easy to maintain Testable
  • 7. How to write good code?
  • 9. Good code requires constant REFACTORING
  • 10. The Code Quality Star Coding Standards Code Review Automated Tests Code Complexity Architecture Design Source
  • 11. Code should be easy to read
  • 12.
  • 13. Code should be readable Avoid comments but avoid obvious ones (the code should be self-explanatory) Avoid comments too verbose Comments need to be maintained
  • 15. The Zen of Python (PEP20) Beautiful is better than ugly Explicit is better than implicit Simple is better than complex Complex is better than complicated Readability counts
  • 16. Coding Style: Readability Counts “Programs must be written for people to read, and only incidentally for machines to execute.” Abelson & Sussman, Structure and Interpretation of Computer Programs
  • 17. PEP8: Style guide for Python Indentation Maximum line length Blank lines Redundant white spaces Imports Comments Naming conventions …
  • 18. How to check /enforce PEP8 Pycharm (Tools > Flake8) Git pre-commit hook (http://goo.gl/bteYkq) Jenkins job for continuous integration
  • 20.
  • 21.
  • 22. Naming best practises Adopt a convention and stick with it (fetch vs. retrieve vs. get) Use intention-revealing names Avoid misleading readers Make meaningful distinctions Use searchable names Avoid mental mapping Use domain names From Clean code, R. Martin
  • 24. Best Practices in Code Architecture OOP DRY SOLID Loose Coupling
  • 25. Don’t Repeat Yourself (aka DRY) http://www.sonarqube.org/manage-duplicated-code-with-sonar/
  • 26. SOLID principles • SRP: Single Responsibility Principle • OCP: Open/closed principle • LSP: Liskov substitution principle • ISP: Interface segregation principle • DIP: dependency inversion principle
  • 33. Main principles Split components into repositories Web app: use clean layers view / endpoint (presentation) service (business logic) DAO (model) Use message bus for communication inter-components (i.e. RabbitMQ) Use daemons / workers for long-running tasks Use events / signals to decouple unrelated actions Microservices
  • 34.
  • 35. Architecture at Cloudlock Nginx AWS VPC Web Server API Server Message Bus (RabbitMQ) RDS PostgreSQL ElastiCache Redis Authentication Gateway Worker Worker Worker Logs
  • 37.
  • 38. Tools for code review Github Pull Requests Review Board Gerrit Crucible
  • 40.
  • 42. Different types of tests Manual Test Unit Test Integration Test System Test Acceptance/Regression Test (end-to-end) Smoke Test
  • 43. Unit Test Test if small, distinct and isolated portions of code are working as expected, provided some input Mock your dependencies (database, logger, service) Should be very fast No need to test EVERYTHING (i.e. private methods) Frameworks: unittest, pytest and nose
  • 44.
  • 45. Pytest No need for base class (works both for classes and methods) More pythonic than unittest Fixtures (conftest.py) Parametrized tests Markers Various plugins for coverage, bdd, django, twisted… Used for unit tests, integration tests and end to end tests
  • 46. Integration Tests Test communication between services You may mock some of the dependencies depending on what you test
  • 47. System Tests Global test, more functional of the whole system TestApp (Pyramid app) using a test database Call the API and test the expected response code
  • 48. End-to-end tests Splinter: web driver abstraction (firefox, selenium) splinter-pytest: fixtures for browser Plugin for rerun flaky tests, tests with steps Use Selenium Grid to test several browsers
  • 49. Smoke Tests Make sure the system is alive Tests that the components are working Tests that the components can communicate Health check / status page
  • 51.
  • 52. Code Quality Metrics Code Standards Violations (pylint /flake8/pyflakes) LOC (Lines Of Code) Cyclomatic Complexity Unit Tests Coverage
  • 53. Code Coverage Makes sense only for unit tests Calculates the coverage based on the paths run by the tests 100% coverage is not a goal on its own May be misleading regarding the code quality
  • 54. Unit Test Diff Coverage
  • 55. Mutation Analysis From Mutation analysis vs. code coverage in automated assessment of students’ Testing Skills (P. Ihantola)
  • 56. Pylint Report ====== 85 statements analysed. ! Duplication ----------- ! +-------------------------+------+---------+-----------+ | |now |previous |difference | +=========================+======+=========+===========+ |nb duplicated lines |0 |0 |= | +-------------------------+------+---------+-----------+ |percent duplicated lines |0.000 |0.000 |= | +-------------------------+------+---------+-----------+ !!! Messages by category -------------------- ! +-----------+-------+---------+-----------+ |type |number |previous |difference | +===========+=======+=========+===========+ |convention |18 |18 |= | +-----------+-------+---------+-----------+ |refactor |2 |2 |= | +-----------+-------+---------+-----------+ |warning |1 |1 |= | +-----------+-------+---------+-----------+ |error |4 |4 |= | +-----------+-------+---------+-----------+ !!! Messages -------- ! +-----------------------------+------------+ |message id |occurrences | +=============================+============+ |line-too-long |10 | +-----------------------------+------------+ |no-name-in-module |4 | +-----------------------------+------------+ |missing-docstring |4 | +-----------------------------+------------+ Global evaluation ----------------- Your code has been rated at 5.18/10 (previous run: 5.18/10, +0.00) ! Raw metrics ----------- ! +----------+-------+------+---------+-----------+ |type |number |% |previous |difference | +==========+=======+======+=========+===========+ |code |90 |63.83 |90 |= | +----------+-------+------+---------+-----------+ |docstring |30 |21.28 |30 |= | +----------+-------+------+---------+-----------+ |comment |5 |3.55 |5 |= | +----------+-------+------+---------+-----------+ |empty |16 |11.35 |16 |= | +----------+-------+------+---------+-----------+ !!! Statistics by type ------------------ ! +---------+-------+-----------+-----------+------------+---------+ |type |number |old number |difference |%documented |%badname | +=========+=======+===========+===========+============+=========+ |module |1 |1 |= |0.00 |0.00 | +---------+-------+-----------+-----------+------------+---------+ |class |2 |2 |= |100.00 |0.00 | +---------+-------+-----------+-----------+------------+---------+ |method |1 |1 |= |100.00 |0.00 | +---------+-------+-----------+-----------+------------+---------+ |function |6 |6 |= |50.00 |33.33 | +————+-------+-----------+-----------+------------+---------+ !!!!!!!!!!
  • 58. Why do you need automated tests? ! Optimise speed, efficiency and quality Catch the bugs upfront Safety net for refactoring
  • 59.
  • 60. On the Road to Continuous Integration
  • 61. Several “Continuous” processes Continuous Integration Continuous Deployment Continuous Delivery
  • 62. Several platforms for CI Jenkins Travis CI Circle CI Shippable BuildBot
  • 63. Continuous Integration Flow Feature Branch Develop Branch Git Push Updates Github PR Several jobs: - pep8 compliance - unit test - integration test - end to end test Merge PR Pull Request Tag Deployment Code Review
  • 65.
  • 66.
  • 68. Pick the right tool to deploy AWS ElasticBeanstalk AWS OpsWorks Chef Puppet SaltStack Ansible
  • 70. It works only on my machine
  • 71. The Docker Project Run everywhere Run everything Advantages: • Pricing • Speed • Unifying environments • Testability / reproducibility • Easily add/replace components
  • 72. Docker on your Mac http://www.warski.org/blog/2014/05/spray-server-docker-container/docker-stack-5/
  • 74.
  • 75. Production Monitoring AWS CloudWatch End-to-end tests running in Jenkins StackDriver Log analysis (streams)
  • 77. Python developers WANTED Contact: dmelamed@cloudlock.com