O'Reilly logo
live online training icon Live Online training

Python for DevOps

Learn Fiercely Effective Automation

Noah Gift

The world has changed a lot in the last decade: Python is one of the most popular languages in the world, the cloud is ubiquitous, and data is hot. Another big change is everyone needs some type of automation. This course covers fiercely effective ways to “get stuff done” in Python. This will be taught using Colab, an interactive Jupyter environment, with hands-on code examples throughout the course.

With software systems, for every failed perfect solution that never got implemented, there is a reasonable solution that could have improved things. Learn to embrace imperfect, but useful, automation and you will never look at a boring task the same way again.

What you'll learn-and how you can apply it

By the end of this live, hands-on, online course, you’ll understand:

  • Continuous Delivery with Python
  • Testing, linting and code quality with Python
  • How to automate tasks with command-line tools in Python

And you’ll be able to:

  • Build command-line tools with the Click Framework
  • Use the subprocess module to run Unix shell commands
  • Create a continuous delivery process using CircleCI from scratch

This training course is for you because...

  • You are a DevOps engineer and want to automate tasks more effectively
  • You perform IT and want to get into DevOps
  • You are a developer who wants to become better at DevOps

Prerequisites

  • Beginning Python skills (or proficiency in a scripting language and a basic understanding of Python syntax)
  • Basic understanding of cloud computing concepts
  • Comfort working with Linux

Recommended preparation:

  • Download or clone the code repository for the course: https://github.com/paiml/python_devops_book
  • Get a refresher on any unfamiliar Python concepts by watching Python for Data Science Complete (video course) or reviewing any relevant portions of Python for Data Science (website).
  • A free Google account will be needed to access notebooks in Google Colab. While a Google account is not required, it is strongly recommended to get the benefit of full participation with the exercises. (If you are unable to use Google Colab, a downloadable notebook will be available via a Github repo.)

Recommended follow-up:

  • Explore Essential Machine Learning and Pragmatic AI (learning path). Learn about cloud-native Machine Learning with a DevOps mindset with examples showing how to perform AI/ML tasks with Python.
  • Explore AWS Certified Machine Learning-Specialty ML (learning path). Learn how to operationalize AWS Machine Learning models and apply cloud-native DevOps patterns with this video.
  • Read Cloud Native DevOps with Kubernetes (book). In this friendly, pragmatic book, cloud experts John Arundel and Justin Domingus show you what Kubernetes can do—and what you can do with it. You’ll build, step by step, an example cloud-native application, and its supporting infrastructure, along with a development environment and continuous deployment pipeline that you can use for your own application.
  • Read Python for DevOps (book). Continue on your DevOps journey and learn to automate tasks using Python, work with continuous integration systems, and mix shell and Python commands to solve problems.

About your instructor

  • Noah Gift is lecturer and consultant at both UC Davis Graduate School of Management MSBA program and the Graduate Data Science program, MSDS, at Northwestern. He is teaching and designing graduate machine learning, AI, Data Science courses and consulting on Machine Learning and Cloud Architecture for students and faculty. These responsibilities including leading a multi-cloud certification initiative for students. He has published close to 100 technical publications including two books on subjects ranging from Cloud Machine Learning to DevOps. Gift received an MBA from UC Davis, a M.S. in Computer Information Systems from Cal State Los Angeles, and a B.S. in Nutritional Science from Cal Poly San Luis Obispo.

    Professionally, Noah has approximately 20 years’ experience programming in Python. He is a Python Software Foundation Fellow, AWS Subject Matter Expert (SME) on Machine Learning, AWS Certified Solutions Architect and AWS Academy Accredited Instructor, Google Certified Professional Cloud Architect, Microsoft MTA on Python. He has worked in roles ranging from CTO, General Manager, Consulting CTO and Cloud Architect. This experience has been with a wide variety of companies including ABC, Caltech, Sony Imageworks, Disney Feature Animation, Weta Digital, AT&T, Turner Studios and Linden Lab. In the last ten years, he has been responsible for shipping many new products at multiple companies that generated millions of dollars of revenue and had global scale. Currently he is consulting startups and other companies.

Schedule

The timeframes are only estimates and may vary according to how the class is progressing

Introduction to Python for DevOps (55 minutes)

  • Presentation: What is DevOps anyway?
  • Presentation: Procedural Statements
  • Presentation: Lists and Dictionaries
  • Exercise: Write a dictionary with a mutable key.
  • Presentation: Functions, Lazy Expressions, Async and Concurrency, IPython terminal
  • Exercise: Write a function that returns infinite random values
  • Exercise: Capture the output of a shell command using the ! operator and parse with SList grep
  • Q&A
  • Break (5 minutes)

Automating Text and Filesystem (55 minutes)

  • Presentation: Reading, Writing and Using files: TXT, CSV, and YAML
  • Exercise: Read and Write a YAML file
  • Presentation: Managing files and directories using os.path and pathlib
  • Exercise: Use pathlib to rename files
  • Presentation: Walking directory trees using os.walk
  • Presentation: Getting stat information on files and directories
  • Presentation: Finding files: duplicates, globbing, and patterns
  • Exercise: Find files using glob
  • Q&A
  • Break (5 minutes)

Developing with the Command Line (55 minutes)

  • Presentation: Setting up a Python project with VSCode and pip
  • Presentation: Using sys.argv
  • Exercise: Write a command-line tool with sys.argv
  • Presentation: Using click CLI Framework
  • Write a command-line tool with click
  • Presentation: click, subprocess.run, and mixing shell and Python together
  • Q&A
  • Break (5 minutes)

Continuous Integration and Delivery (60 minutes)

  • Presentation: Creating Makefiles
  • Exercise: Create a Makefile
  • Presentation: Creating Python virtualenv
  • Exercise: Create and use virtualenv
  • Presentation: Linting and testing Python code with Pylint and PyTest
  • Exercise: Lint code with Pylint
  • Presentation: Configuring CircleCI Continuous Integration with Github
  • Exercise: Setup github repo to build with CircleCI
  • Presentation: What is Continuous Delivery?
  • Q&A