Along with the code
Tool, Tips and Techniques
to make your Python programming life
enjoyable
Yothin (Man) Muangsommuk
@yothinix
Prerequisite
The 5 Cores of Programming Languages
The 5 Cores of Programming Languages
Virtualenvs
A quick fix to activate virtualenv on Windows Powershell
This happen because Windows PowerShell not allow to execute the script by default. We need to tell Powershell to allow executing the script from following step
A quick fix to activate virtualenv on Windows Powershell
A quick fix to activate virtualenv on Windows Powershell
2. Entering command: set-executionpolicy RemoteSigned then hit Enter
3. When command ask for confirm type: Y then hit Enter
A quick fix to activate virtualenv on Windows Powershell
4. Try to activate virtualenv on VSCode again with .\venv\Scripts\Activate.ps1 it should work now. Can see by having little green (venv) in front of the new line
Installing dependencies
Maintaining dependencies rules
* See more in PEP-044 https://www.python.org/dev/peps/pep-0440/#compatible-release
How can I know that my code work?
?
How can I know that my code work?
Unit Testing
Unit testing
* See more in F.I.R.S.T Principles ของ Unit Test�** Also can describe as Given, When, Then if we seen in Behavior
Test Driven Development (TDD)
Originate from Test-First Programming concept in XP in 1999
Test Driven Development can be divided into 5 stages
Debugger
Python debugger (pdb)
What can we do with debugger
VSCode Python debugger
Coding Style
PEP 8 - Style Guide for Python Code
Linter
Flake8 - Your go to Python code linter
Formatter
Black - the uncompromising Python code formatter
Key takeaway