Python for DevOps: Mastering Real-World Automation

Master Python for DevOps and CI/CD with 23+ hours, 35+ quizzes and 25+ coding labs to build and deliver DevOps tools

  • 0.0 (0 Reviews)
  • 0 Students
  • 291 Lessons
  • Lauro Fialho Müller

Course Overview

Welcome to the definitive Python for DevOps course! Are you ready to move beyond simple scripts and start building powerful, reliable, and production-grade automation? This course is meticulously designed to equip you, the DevOps engineer, SRE, or system administrator, with the essential Python skills to automate your infrastructure and streamline your DevOps workflows. It offers a highly practical curriculum, packed with quizzes and coding labs for you to practice everything we discuss in the lectures.

Why Learn Python for DevOps?

Python has become the universal language for infrastructure automation, and for good reason. Mastering it is a critical step for any modern DevOps professional. Here’s why:

  • Automate Everything: Stop doing repetitive manual work! With Python, you can automate interactions with any REST API, manage cloud resources, update configurations, and orchestrate complex deployment pipelines. This course will teach you how to write scripts that do the work for you.

  • Become a More Versatile and Valuable Engineer: Python is the "glue" that connects different systems. By learning to script interactions between your CI/CD tools, monitoring platforms, and cloud services, you become the go-to person for solving complex integration challenges, making you an indispensable part of your team.

  • Write Robust, Maintainable Tools: A simple script might work once, but professional automation needs to be reliable. This course goes beyond basics to teach you how to write code that includes proper error handling, logging, and automated tests, ensuring the tools you build are trusted and easy to maintain.

  • Boost Your Career: Proficiency in Python automation is one of the most in-demand skills in the tech industry. Adding these skills to your resume will make you a more attractive candidate for new roles, promotions, and higher-paying opportunities.

By investing in this course, you’re not just learning a language; you’re acquiring a powerful toolkit to solve real-world DevOps problems efficiently and reliably.

Why Choose This Course?

This course is built from the ground up with a DevOps focus, offering a unique blend of core Python concepts and their practical application in infrastructure environments.

  • Practical, DevOps-Focused Approach: We won't be building web apps or doing data science. Every lecture, example, and exercise is tailored to the world of DevOps. You'll work with files, APIs, system commands, and data formats like JSON and YAML - the things you use every day.

  • Practice, Practice, Practice: We go beyond theoretical discussions and dive deep into coding everything we discuss. In addition to the video lectures, the course is packed with quizzes and coding labs that will help you solidify every concept we discuss!

  • Go Beyond the Basics: This isn't just a "learn Python syntax" course. We dive deep into advanced, powerful features like generators for memory-efficient data processing, decorators for adding reusable functionality, context managers for safe resource handling, logging for production-grade, robust application logging, and much more! You'll learn to write code that is not just functional, but also elegant and efficient.

  • Focus on Production-Ready Code: Learn how to build automation that you can trust in production. We dedicate entire sections to crucial topics like structured logging, advanced exception handling, implementing retries with exponential backoff, and, most importantly, automated testing with pytest.

Which Skills Will You Acquire During This Course?

As you go through this course, you will gain a comprehensive and valuable set of skills, including:

  • Master Python Fundamentals: Build a rock-solid foundation in Python syntax, data structures (lists, dictionaries, sets), control flow, functions, and object-oriented principles.

  • Leverage Advanced Python Features: Harness the power of generators for efficient data pipelines and decorators for adding cross-cutting concerns like logging and retries without cluttering your code.

  • Write Resilient, Production-Grade Scripts: Implement structured logging for better observability and craft robust exception handling logic to make your automation fail gracefully.

  • Ensure Reliability with Automated Testing: Master pytest to write effective unit tests. You'll learn everything from basic assertions and fixtures to advanced techniques like parametrization and isolating dependencies with mocks.

  • Automate System and File Operations: Confidently manage the file system using modern pathlib and run external commands securely with the subprocess module.

  • Interact With Any REST API: Master the requests library to send GET and POST requests, handle various authentication methods (basic, token), and build resilient clients that can handle timeouts and retries.

  • Handle Essential Data Formats: Fluently parse, process, and generate the data formats that power DevOps: JSON, YAML, and CSV.

  • Build and Package Professional Tools: Structure your Python projects with modules and packages, and use pyproject.toml to create and distribute your own installable command-line tools.

  • Build complete CI/CD workflows for Python projects: Leverage GitHub Actions to build fully automated CI/CD pipelines to publish your Python libraries in the Python Package Index.

Get ready to transform your capabilities and elevate your career. Let's start building powerful DevOps automation together!

See more

FAQ

FAQ area empty

Course curriculum

14 chương 291 bài học 23 giờ 40 phút 7 bài học thử miễn phí
Chương 1 Welcome and Introduction
Chương 2 Setting Up and Running Python
Chương 3 Python Fundamentals
  • Section overview 1:20
  • Variables 4:40
  • Comments 3:15
  • Numbers 7:32
  • Strings 12:41
  • Hands-on: Disk usage calculation 3:33
  • Python Core Concepts
  • Introduction to lists 7:18
  • Modifying list contents 9:51
  • Hands-on: Practicing working with lists 2:20
  • Tuples 6:01
  • Introduction to sets 5:53
  • Set operations 6:01
  • Hands-on: Practicing working with sets 4:30
  • Differentiating between lists, tuples, and sets 2:36
  • Introduction to dictionaries 12:12
  • Dictionary operations 5:38
  • Hands-on: Practicing working with dictionaries 5:56
  • Python Data Collections
  • Introduction to conditional code execution 3:29
  • If/elif/else statements 8:47
  • Guard clauses 5:02
  • For and while loops 6:53
  • Break and continue statements 3:59
  • Introduction to list comprehension 4:01
  • List, set, and dictionary comprehension 7:53
  • Control Flow and Concise Iteration
  • Configuration Validator
  • Introduction to functions 2:05
  • Defining functions and returning values 5:09
  • Parameters and arguments 8:19
  • Docstrings 4:11
  • Hands-on: Practicing working with functions 7:40
  • The range function 7:53
  • Enumerate and ZIP functions 7:01
  • Functions and Iteration Tools
  • Log Line Parser
  • Server Inventory Reporter
  • Introduction to classes 5:40
  • Class methods 4:59
  • Inheritance 7:38
  • Object-Oriented Programming in Python
  • Object-Oriented Deployment Manager
  • Introduction to *args and **kwargs syntax 6:10
  • Order in *args and **kwargs arguments 8:32
  • Calling functions: *args and **kwargs 6:04
  • Working with flexible arguments
  • Flexible Resource Tagger
  • Lambda functions 3:18
  • Sorting collections with lambda 3:17
  • Transforming collections with lambda 2:33
  • Filtering collections with lambda 2:03
Chương 4 Generators and Decorators
  • Section overview 1:32
  • The iteration protocol 5:18
  • Iterator and iterable code demo 9:18
  • Generator syntax 6:15
  • The yield statement 5:23
  • Pausing and resuming generator execution 3:47
  • State in generators 5:36
  • Generator exhaustion 1:58
  • Return vs. yield statements 5:06
  • Generator Fundamentals
  • Hands-on: Practicing working with generators 8:12
  • Log File Line Generator
  • Coding lazy pipelines 18:38
  • Building Lazy Pipelines with Generators
  • Configuration File Processing Pipeline
  • Functions as first-class citizens 6:31
  • Factory functions 2:50
  • Functions in data structures 3:08
  • Introduction to decorators 7:04
  • Arguments in decorators 8:54
  • Handling return values in decorators 3:44
  • Decorator Fundamentals and Best Practices
  • Argument sanitizer
  • Handling exceptions in decorators 3:19
  • The functools.wraps decorator 4:45
  • Role-Based Access Control (RBAC) Decorator Factory
  • Stacking decorators 6:03
  • Advanced Decorator Practices
Chương 5 Error Handling and Context Managers
  • Section introduction 1:37
  • Exceptions syntax 3:57
  • Thinking in exceptions 4:22
  • Inspecting built-in exceptions 7:10
  • OS and KeyError exceptions 8:08
  • Index, Value, and TypeError exceptions 5:57
  • Attribute and ImportError exceptions 5:31
  • Python Exception Handling: The Fundamentals
  • The raise statement 5:05
  • Raising exceptions 5:56
  • Validating Inputs for Flexible Resource Tagger
  • Validating Inputs for Object-Oriented Deployment Manager
  • Defining custom exceptions 3:07
  • Adding context to custom exceptions 8:59
  • Raising and Defining Custom Exceptions
  • Robust RBAC Decorator with Custom Exceptions
  • Advanced Retry Decorator with Exponential Backoff and Jitter
  • Manual context cleanup 5:21
  • The context manager protocol 4:09
  • Context managers and the "with" statement 7:05
  • Defining custom context managers 5:56
  • The contextmanager decorator 9:56
  • Resource Management with Context Managers
Chương 6 Logging for Operations
  • Section introduction 1:33
  • Why logging? 7:57
  • Introduction to logging anatomy 6:37
  • Hands-on: Practicing logging anatomy 13:24
  • Log levels 15:29
  • Python Logging: Core Concepts and Mechanics
  • Basic Script Activity Logger
  • File handlers 4:51
  • Rotating log files by size 8:18
  • Rotating log files by time 8:47
  • Log Rotator for a Monitoring Service
  • Structured logging with JSON 11:29
  • Extra fields and exceptions in structured logging 4:56
  • Practical Logging: File Handlers and Structured JSON Output
  • Log configuration with INI files 12:40
  • Log configuration with dictionaries 7:32
  • Log configuration with JSON files 6:00
  • Dynamic log configuration 7:40
  • Declarative and Dynamic Logging Configuration
  • Dynamic Logging Configuration with Verbose Mode
Chương 7 Files, Regex, and Serialization
  • Section introduction 1:48
  • The Path object 6:03
  • Listing directory contents, reading and writing files 6:43
  • Read and write modes deep-dive 8:28
  • Read and write methods deep-dive 11:29
  • File System Interaction and I/O
  • Log File Archiver
  • Regex: Introduction and essentials 13:03
  • Regex: Quantifiers, greedy, and non-greedy search 8:51
  • Regex: Capturing groups 8:30
  • Regex: Non-capturing groups 3:40
  • Log Line Error Detector
  • User Login Event Parser
  • Regex: Back-references 5:58
  • Regex: findall() and finditer() 6:21
  • Regex: String splitting 10:51
  • Regex: String substitution 12:27
  • Text Processing with Regular Expressions
  • Sensitive Data Redactor in Configuration Files
  • JSON deserialization 9:05
  • JSON serialization 5:04
  • JSON Configuration Updater
  • Introduction to YAML operations 7:58
  • YAML serialization and deserialization 7:59
  • Reading CSV files 8:46
  • Writing CSV files 7:57
  • Working with Data Formats (JSON, YAML, CSV)
Chương 8 System Interaction and Automation
  • Section introduction 1:14
  • Accessing environment variables 8:10
  • Setting and deleting environment variables 5:19
  • Dotenv files 6:42
  • Environment Variables and Configuration
  • Listing directory contents 5:36
  • Creating directories 3:39
  • Deleting files and directories 4:21
  • Copying files and directories 4:43
  • Backup Script with Directory Cleanup
  • Moving files and directories 8:22
  • Temporary files 9:57
  • Temporary directories 4:48
  • Filesystem and Directory Operations
  • Introduction to subprocesses 10:31
  • Handling subprocess errors 5:43
  • Handling expired timeouts 3:27
  • Running and Managing Subprocesses
  • System Health Checker with ping
Chương 9 Interacting with APIs using requests
  • Section introduction 1:06
  • Creating a GitHub Personal Access Token (PAT) 2:07
  • GET requests 7:43
  • Query parameters 8:01
  • POST requests 6:27
  • Making and Inspecting HTTP Requests
  • Public Holiday Checker
  • HTTP status codes 5:18
  • Raise for HTTP status 4:38
  • Basic authentication 7:02
  • Token-based authentication 6:30
  • Jenkins Job Trigger
  • PagerDuty Incident Fetcher
  • Handling timeouts 3:45
  • Robust API Interaction: Authentication and Error Handling
  • Retries: Simple strategy 6:32
  • Retries: Exponential backoff with jitter 10:48
  • Advanced Resilience: API Retry Strategies
Chương 10 Static Typing and Type Hints
  • Section introduction 1:30
  • [For VS Code Users] - Pylance configuration values I'm using for VS Code 1:49
  • Introduction to type hints 10:53
  • Type hints: Common pitfalls 5:01
  • Annotating a Basic Configuration Loader
  • Typing lists 4:46
  • Typing dictionaries, tuples and sets 5:35
  • Union and optional types 10:06
  • Python Type Hints: Foundations and Basic Collections
  • Typing a User and Role Management Function
  • Typed dictionaries 5:15
  • Typing classes 9:49
  • Forward type references 4:24
  • Structured Typing: TypedDict and Custom Classes
  • Server Object Factory from Dictionary
  • Introduction to generics 7:58
  • Constrained type variables 4:18
  • Bounded type variables 8:01
  • Generics and classes 8:25
  • Advanced Flexibility with Generics
  • Typing decorators 8:01
  • Improving decorator types 4:29
  • Typing generators 5:09
  • Typing iterables and iterators 3:08
  • Typing Decorators and Generators
Chương 11 Automated Testing with Pytest
  • Section introduction 1:35
  • Assertions in Pytest 5:13
  • Hands-on: Test-driven implementation 20:17
  • Inspecting failure output and float approximation 3:33
  • Testing exceptions 3:02
  • Marking tests as expected failures 2:06
  • Pytest configuration 4:49
  • Skipping tests 6:10
  • Indicating expected failures 3:36
  • Custom markers 6:25
  • Pytest Fundamentals: Assertions, Markers, and Configuration
  • Introduction to fixtures 10:44
  • Fixture scopes 8:05
  • Sharing fixtures in conftest.py 4:52
  • Introduction to parametrization 8:38
  • Using the param function 10:56
  • Managing Test State with Fixtures and Parametrization
  • Mocking fundamentals 8:17
  • Patch decorator and mocker fixture 6:07
  • Configuring mock objects 11:49
  • Setting exceptions and lists as side effect 8:16
  • Using callable as side effect 8:39
  • Mock vs. MagicMock 5:48
  • Advanced Testing Techniques: Mocking with Pytest
Chương 12 Structuring Python Projects
  • Section introduction 1:47
  • Python modules 7:39
  • Python packages 7:18
  • Python Modules and Packages: The Fundamentals
  • Introduction to subpackages 8:12
  • Absolute vs. Relative imports 8:55
  • Common import errors and how to fix them 6:59
  • Navigating Packages: Imports and Submodules
  • Running Python modules 12:17
  • Pyproject.toml file 7:31
  • Adding tests to multi-file projects 9:30
  • Creating Installable Projects with pyproject.toml
Chương 13 CI/CD for Python Projects
  • Section introduction 3:02
  • Introduction to click 3:11
  • CI/CD tooling for our project 5:14
  • CI/CD pipeline overview 3:22
  • Setup GitHub repository and local environment 3:58
  • Implementation plan overview 3:09
  • Creating our pyproject.toml file 4:51
  • Implementing the HTTP checker module 8:29
  • Implementing the CLI script - Part 1 7:13
  • Implementing the CLI script - Part 2 7:21
  • GitHub Actions - Deploy minimal workflow 5:34
  • Add linting and format checks 12:35
  • Add static type and security checks 10:58
  • Pytest - Setup and configuration 6:46
  • Pytest - Implement HTTP checker tests 13:53
  • Pytest - Implement CLI tests 8:24
  • Pytest - Integrate automated tests in the workflow 7:47
  • Quality Checks with GitHub Actions
  • Building the Python library 7:19
  • Configuring PyPI account and OIDC information 8:03
  • Configure Semantic Release 8:41
  • Integrate Semantic Release in the workflow 6:48
  • Publishing to TestPyPI 12:44
  • Publishing to PyPI 4:17
  • Optimize workflow to leverage release assets 7:39
  • Building and Publishing to PyPI
Chương 14 Conclusion
  • Congratulations + BONUS lecture!

Requirment

  • Familiarity with basic programming concepts (variables, loops, functions) from any scripting or programming language.

  • Basic experience using a command-line terminal for navigating directories and executing commands.

  • A high-level understanding of common DevOps concepts like APIs, CI/CD, and infrastructure automation.

  • The ability to install software on your computer, such as Python itself and third-party packages using pip.

  • A desire to move beyond simple shell scripts and build robust, maintainable, and production-ready automation.

  • Basic familiarity with git to clone the course repository and naviage different branches

Outcomes

  • Master Python fundamentals from variables and data structures to functions and classes.

  • Write elegant and memory-efficient code using advanced features like generators and decorators.

  • Implement robust error handling with try/except blocks and custom exceptions to build resilient scripts.

  • Integrate structured JSON logging into your applications for improved observability and troubleshooting.

  • Confidently parse, process, and generate essential data formats like JSON, YAML, and CSV.

  • Automate file and directory management using modern pathlib and shutil.

  • Run external system commands securely and capture their output using the subprocess module.

  • Automate REST API interactions by sending GET/POST requests and handling authentication with the requests library.

  • Build resilient API clients that handle timeouts and implement retry logic with exponential backoff.

  • Write and run professional unit tests using the powerful pytest framework.

  • Use fixtures and parametrization to write clean, reusable, and data-driven tests.

  • Isolate dependencies and test complex interactions by creating and configuring mocks.

  • Structure your code professionally using Python modules and packages for better maintainability.

  • Build and distribute your own installable command-line tools using pyproject.toml and entry points.

Instructor

...
Lauro Fialho Müller

0.0

  • ... 0 Student
  • ... 5 Courses
  • ... 0 review

View Details

Reviews

Rate this course :

Remove all