Efficient Python Production Workflows

Reading time ~1 minute

Main Course Link

This Series is a part of 30 Days of Learning.

  • A good process avoid mistakes.
    • Automation
    • Checklists
    • Knowledge Transfer
  • OODA
    • Observe
    • Orient
    • Decide
    • Change
  • Dependency Management
    • Use package manager, venv. use requiremnts.txt
    • Have separate requirements file for prod and dev
    • –find-links to find internal packages.
    • Use docker file
  • Testing
    • Best value Tests
      • Deployment
      • Integration
      • Regression
      • Fuzzing
      • Unit
      • Linters
    • Know which type of tests must have caught the bug.
    • CI detects much class of errors. ex: Jenkins
    • Mark tests. Ideally, dev tests should not take more than 1 minute to run.
  • Logging
    • what? format? How many? where to store?
    • Log Levels and log.ini file.
    • Logging is a balance between too much and too little.
    • Use structured logging, like JSON. It’s easier for parsing.
    • Log aggregators
  • Metrics
    • Measurements about the system. Helps in detecting outliers.
    • Prometheus metrics: Gauge, counter, histograms.
    • They should be based on Business. Use KPIs. Strive to get actual numbers. Have SLA in numbers.
    • Use Decorators. Prometheus gives ready-made decorators.
    • Push vs pull-based metric systems.
    • Alerting system based on metrics. ex: PagerDuty.
  • Deployment Methods
    • Blue-Green deployment
      • Direct traffic from blue to green.
    • Rolling and Canary
    • Deployment should be automated. ex: Fabric: FabFile.py.
    • Try to mimic production in testing.

Walking around in Ranikhet and Majkhali

In every walk with nature one receives far more than he seeks... The COVID restrictions were lifted and the itch to travel had started ye...… Continue reading

Python GUI Development: Tkinter

Published on June 23, 2021

Remote Office for Maximum Productivity

Published on June 22, 2021