Back to articles
How I Automated My Entire Dev Workflow with Python (15 Hours Saved Per Week)

How I Automated My Entire Dev Workflow with Python (15 Hours Saved Per Week)

via Dev.to Pythonmaquankun

How I Automated My Entire Dev Workflow with Python (15 Hours Saved Per Week) Every Friday I spent 3 hours on: deployments, reports, cleanup, notifications. Now a Python script does it in 4 minutes. Here is every automation, with code you can steal. 1. Auto-Deploy on Git Push (Saves 30 min/deploys) import subprocess def deploy (): subprocess . run ([ " git " , " pull " , " origin " , " main " ], check = True ) result = subprocess . run ([ " pytest " , " --tb=short " ], capture_output = True ) if result . returncode != 0 : notify ( f " Tests failed! " ) return subprocess . run ([ " docker " , " compose " , " up " , " -d " , " --build " ], check = True ) notify ( " Deployed successfully! " ) Pair with a Raspberry Pi 5 as a dedicated deploy server. 2. Weekly Report Generator (Saves 1 hr/week) import git from datetime import datetime , timedelta from collections import Counter def weekly_report ( repo_path ): repo = git . Repo ( repo_path ) week_ago = datetime . now () - timedelta ( days =

Continue reading on Dev.to Python

Opens in a new tab

Read Full Article
6 views

Related Articles