SlideShare a Scribd company logo
1 of 39
Download to read offline
ealthy practices for
happy and successful codebase
Misha Behersky KyivPy, September, 2016
Code style
2
Same code
3
Bearsharktopus
4
pep8 is not enough
Grid, vertical, hanging indent, vertical hanging indent, hanging grid...
5
isort
standard library modules
third-party modules
user-defined modules
6
pycodestyle, pyflakes, pylint,
pychecker, etc.
● No global found
● Passing the wrong number of parameters
● Using format strings that don't match arguments
● Using a variable before setting it
● self is not the first parameter defined for a method
● Unused function/method arguments (can ignore self)
● No doc strings in modules, classes, functions
● ...
7
tick with strict rules
8
Managing requirements
9
pgrade fast
pypiup pip-tools
10
Dependency hell
11
Environments
● Develop in env that is as close as possible to production
one
● Test in all possible envs that your app might run
● Select your favourite IDE and use it)
12
Testing
● Test what's likely to break
● Test negative cases and edge cases
● If writing tests is hard, that might be a bug
● Aggressively make your test suite fast and reliable
● Run it automatically
13
Flaky???
● If it’s flaky it’s not a test*
● Stop calling your build flaky*
*If I was in my office I would bite my tongue
14
o not write tests
15
rief is not better
16
self-descriptive speaks for itself
17
Overcommunicate
18
Naming
19
utomate routine
20
Put your two cents in
21
ail early
22
ail early
23
ail early
24
Dream within a dream
25
elete code as soon as you know you don't
need it any more, no questions asked
26
vulture
27
Are you ready?
28
ime is the only resource you truly need
29
easure everything
30
Wakatime
31
cloc
32
Toggl
33
Other tools
https://github.com/madisonmay/BlackWidow
34
https://github.com/mschwager/cohesion
https://github.com/Yelp/undebt
ecap
● Play stupid
● If you don’t try, you’ll never know
● Save your energy for something better than
programming work
● Consider and reason
● …
● ???
● PROFIT!
35
esources
https://github.com/timothycrosley/isort [6]
http://www.kennethreitz.org/essays/a-better-pip-workflow [10]
https://github.com/ekonstantinidis/pypiup [10]
http://semver.org [11]
https://tox.readthedocs.io/en/latest/ [12]
http://holger-peters.de/using-pyenv-and-tox.html [12]
https://eev.ee/blog/2016/08/22/testing-for-people-who-hate-testing [13]
https://github.com/box/flaky [14]
http://martinfowler.com/bliki/TwoHardThings.html [19]
https://github.com/myint/vulture [27]
http://bmwlog.pp.ua/post/105 [32]
36
&
37
e are hiring
datarobot.com/careers/ 38
hanks for your attention
bmwlog.pp.ua
bmwant@gmail.com
@bmwant
39

More Related Content

What's hot

Unit testing (workshop)
Unit testing (workshop)Unit testing (workshop)
Unit testing (workshop)Foyzul Karim
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - envgrondin
 
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012).NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)lancehilliard
 
Roy Osherove TDD From Scratch
Roy Osherove TDD From ScratchRoy Osherove TDD From Scratch
Roy Osherove TDD From ScratchRoy Osherove
 
Java Consulting tips for Beginners
Java Consulting tips for BeginnersJava Consulting tips for Beginners
Java Consulting tips for BeginnersSathish Chittibabu
 
TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?Dmitriy Nesteryuk
 
The modern view on implementation of classic design patterns in Java
The modern view on implementation of classic design patterns in JavaThe modern view on implementation of classic design patterns in Java
The modern view on implementation of classic design patterns in JavaMikalai Alimenkou
 
The way from DB-driven development to DDD
The way from DB-driven development to DDDThe way from DB-driven development to DDD
The way from DB-driven development to DDDProvectus
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit TestingJoe Tremblay
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?Steven Mak
 
Testing for people who hate testing
Testing for people who hate testingTesting for people who hate testing
Testing for people who hate testingSam Bolgert
 
The Psychology of C# Analysis
The Psychology of C# AnalysisThe Psychology of C# Analysis
The Psychology of C# AnalysisCoverity
 
Transformation themes are ok with laptop hardware?
Transformation themes are ok with laptop hardware?Transformation themes are ok with laptop hardware?
Transformation themes are ok with laptop hardware?gentlekudos302
 

What's hot (14)

Unit testing (workshop)
Unit testing (workshop)Unit testing (workshop)
Unit testing (workshop)
 
Mocking vtcc3 - en
Mocking   vtcc3 - enMocking   vtcc3 - en
Mocking vtcc3 - en
 
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012).NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)
.NET Unit Testing w/ Microsoft Fakes (TechCamp Memphis Spring 2012)
 
Roy Osherove TDD From Scratch
Roy Osherove TDD From ScratchRoy Osherove TDD From Scratch
Roy Osherove TDD From Scratch
 
Java Consulting tips for Beginners
Java Consulting tips for BeginnersJava Consulting tips for Beginners
Java Consulting tips for Beginners
 
TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?TDD — Are you sure you properly test code?
TDD — Are you sure you properly test code?
 
The modern view on implementation of classic design patterns in Java
The modern view on implementation of classic design patterns in JavaThe modern view on implementation of classic design patterns in Java
The modern view on implementation of classic design patterns in Java
 
The way from DB-driven development to DDD
The way from DB-driven development to DDDThe way from DB-driven development to DDD
The way from DB-driven development to DDD
 
An Introduction to Unit Testing
An Introduction to Unit TestingAn Introduction to Unit Testing
An Introduction to Unit Testing
 
Is this how you hate unit testing?
Is this how you hate unit testing?Is this how you hate unit testing?
Is this how you hate unit testing?
 
Testing for people who hate testing
Testing for people who hate testingTesting for people who hate testing
Testing for people who hate testing
 
Working Effectively with Legacy Code
Working Effectively with Legacy CodeWorking Effectively with Legacy Code
Working Effectively with Legacy Code
 
The Psychology of C# Analysis
The Psychology of C# AnalysisThe Psychology of C# Analysis
The Psychology of C# Analysis
 
Transformation themes are ok with laptop hardware?
Transformation themes are ok with laptop hardware?Transformation themes are ok with laptop hardware?
Transformation themes are ok with laptop hardware?
 

Similar to Pep8 is not enough

You and your code.pdf
You and your code.pdfYou and your code.pdf
You and your code.pdfTony Khánh
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAsCarlos Ble
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy CodeAndrea Polci
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Igalia
 
Five steps towards your testing dream
Five steps towards your testing dreamFive steps towards your testing dream
Five steps towards your testing dreamLisa Gagarina
 
Code reviews
Code reviewsCode reviews
Code reviewsRoger Xia
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftAmey Tavkar
 
Maintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia EcosystemsMaintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia EcosystemsChris Rackauckas
 
Puppetizing Your Organization
Puppetizing Your OrganizationPuppetizing Your Organization
Puppetizing Your OrganizationRobert Nelson
 
Random thoughts and dev practices / advices to build a great product
Random thoughts and dev practices / advices to build a great productRandom thoughts and dev practices / advices to build a great product
Random thoughts and dev practices / advices to build a great productGuillaume POTIER
 
Python id meetup, Maintaining a Dirty Code Django Project
Python id meetup, Maintaining a Dirty Code Django ProjectPython id meetup, Maintaining a Dirty Code Django Project
Python id meetup, Maintaining a Dirty Code Django ProjectIkhsan Noor Rosyidin
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programmingJuggernaut Liu
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# DevelopersSarah Dutkiewicz
 
Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissorsMorgan Roman
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developersJan Giacomelli
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolatorMaslowB
 

Similar to Pep8 is not enough (20)

You and your code.pdf
You and your code.pdfYou and your code.pdf
You and your code.pdf
 
Best practices for JavaScript RIAs
Best practices for JavaScript RIAsBest practices for JavaScript RIAs
Best practices for JavaScript RIAs
 
Working With Legacy Code
Working With Legacy CodeWorking With Legacy Code
Working With Legacy Code
 
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)Property-based testing an open-source compiler, pflua (FOSDEM 2015)
Property-based testing an open-source compiler, pflua (FOSDEM 2015)
 
Five steps towards your testing dream
Five steps towards your testing dreamFive steps towards your testing dream
Five steps towards your testing dream
 
Code reviews
Code reviewsCode reviews
Code reviews
 
Test-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in SwiftTest-Driven Development (TDD) in Swift
Test-Driven Development (TDD) in Swift
 
Tdd in swift
Tdd in swiftTdd in swift
Tdd in swift
 
Maintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia EcosystemsMaintaining Large Scale Julia Ecosystems
Maintaining Large Scale Julia Ecosystems
 
Puppetizing Your Organization
Puppetizing Your OrganizationPuppetizing Your Organization
Puppetizing Your Organization
 
Random thoughts and dev practices / advices to build a great product
Random thoughts and dev practices / advices to build a great productRandom thoughts and dev practices / advices to build a great product
Random thoughts and dev practices / advices to build a great product
 
Caveats
CaveatsCaveats
Caveats
 
Python id meetup, Maintaining a Dirty Code Django Project
Python id meetup, Maintaining a Dirty Code Django ProjectPython id meetup, Maintaining a Dirty Code Django Project
Python id meetup, Maintaining a Dirty Code Django Project
 
Reading Notes : the practice of programming
Reading Notes : the practice of programmingReading Notes : the practice of programming
Reading Notes : the practice of programming
 
Intro to Python for C# Developers
Intro to Python for C# DevelopersIntro to Python for C# Developers
Intro to Python for C# Developers
 
Dont run with scissors
Dont run with scissorsDont run with scissors
Dont run with scissors
 
Chapter17 of clean code
Chapter17 of clean codeChapter17 of clean code
Chapter17 of clean code
 
Complete python toolbox for modern developers
Complete python toolbox for modern developersComplete python toolbox for modern developers
Complete python toolbox for modern developers
 
Ui Testing with Ghost Inspector
Ui Testing with Ghost InspectorUi Testing with Ghost Inspector
Ui Testing with Ghost Inspector
 
Type mock isolator
Type mock isolatorType mock isolator
Type mock isolator
 

Recently uploaded

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEOrtus Solutions, Corp
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...OnePlan Solutions
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesŁukasz Chruściel
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Hr365.us smith
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作qr0udbr0
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...Christina Lin
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....kzayra69
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 

Recently uploaded (20)

GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASEBATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
BATTLEFIELD ORM: TIPS, TACTICS AND STRATEGIES FOR CONQUERING YOUR DATABASE
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
Maximizing Efficiency and Profitability with OnePlan’s Professional Service A...
 
Unveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New FeaturesUnveiling the Future: Sylius 2.0 New Features
Unveiling the Future: Sylius 2.0 New Features
 
Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)Recruitment Management Software Benefits (Infographic)
Recruitment Management Software Benefits (Infographic)
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作英国UN学位证,北安普顿大学毕业证书1:1制作
英国UN学位证,北安普顿大学毕业证书1:1制作
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
ODSC - Batch to Stream workshop - integration of Apache Spark, Cassandra, Pos...
 
What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....What are the key points to focus on before starting to learn ETL Development....
What are the key points to focus on before starting to learn ETL Development....
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 

Pep8 is not enough