Introduction
to
Python and DevOps
Keerthi Bandara
EFutures (PVT) Ltd.
Course Content
● Week 1: Introduction to Python and DevOps
a. Introduction to DevOps, Python, and their intersection
b. Python Basics: Data types, variables, conditionals, loops
● Week 2: Intermediate Python
a. Functions, Modules and Libraries
b. File I/O operations, error, and exception handling
c. Functional Programming, List comprehension, Map/Reduce, Filter
● Week 3: Python for System Administration
a. Understanding System Administration Tasks: File management, process management
b. Automating System Administration with Python
● Week 4: Python and APIs
a. Understanding APIs: Basics of REST APIs and JSON
b. Python and APIs: Using Python requests to interact with REST APIs
c. FastAPI Framework
Course Content (cont.)
● Week 5: Python and Infrastructure as Code (IaC)
a. Introduction to Infrastructure as Code
b. Python and Cloud Providers (e.g., AWS Boto3, Google's Python Client for Google Cloud)
● Week 6: Python and Configuration Management
a. Introduction to Configuration Management and tools (Ansible)
b. Python with Ansible: Writing modules and managing Ansible with Python
● Week 7: Python in CI/CD
a. Introduction to Continuous Integration and Continuous Delivery
b. Using Python in CI/CD: Jenkins API, GitHub API, Testing with Python (unittest, pytest)
● Week 8: Python and Containers
a. Introduction to Containers and Orchestration (Docker, Kubernetes)
b. Python with Docker: Docker SDK for Python, automating container deployment
Introduction to DevOps, Python, and Their intersection
● Readability and Simplicity
● Large Standard Library
● Scripting Capabilities
● Cross-Platform Compatibility
● Large Community and Ecosystem
● Integration with DevOps Tools: Examples - Jenkins, Docker, Kubernetes,
and AWS.
● Data Processing and Analysis
● Versatility
Python Installation
Virtual Environments
● python -m venv /path/to/new/virtual/environment
● pip3 freeze > requirements.txt
IDEs and Notebooks (Jupyter)
● IDLE
● Pycharm
● VSCode
● Jupyter Lab
Python Basics
● Data Types
● Variables
● Conditionals
● Loops
● Functions
● OOP
Data Types
Text Type: str
Numeric Types: int, float, complex
Sequence Types: list, tuple, range
Mapping Type: dict
Set Types: set, frozenset
Boolean Type: bool
Binary Types: bytes, bytearray, memoryview
None Type: NoneType
Operators
Arithmetic Comparison Assignment
+ (addition) == (equal to) = (assigns a value)
- (subtraction) != (not equal to) += (adds right operand to
* (multiplication) < (less than) the left operand and assigns
/ (division) > (greater than) the result)
// (floor division) <= (less than or equal to) -= (subtracts ~)
% (modulo, returns the >= (greater than or equal to) *= (multiplies ~)
remainder of a division) /= (divides ~)
** (exponentiation) %= (modulus ~)
**= (exponentiation ~)
Keywords