O'Reilly logo
live online training icon Live Online training

Python for DevOps - Learn fiercely effective automation

Topic: System Administration
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. And everyone needs some type of automation. With software systems, for every failed perfect solution that was never implemented, there’s a reasonable solution that could have improved things.

Join expert Noah Gift to learn fiercely effective ways to “get stuff done” in Python using Google Colab, an interactive Jupyter environment, with hands-on code examples. Along the way, you’ll learn to embrace imperfect, but useful, automation. You’ll 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 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’re a DevOps engineer and want to automate tasks more effectively.
  • You’re in IT and want to get into DevOps.
  • You’re a developer and want to become better at DevOps.

Prerequisites

  • Experience with Python or another scripting language
  • A basic understanding of cloud computing and Python syntax
  • A working knowledge of Linux
  • A machine with the code repository for the course downloaded or cloned
  • A free Google account (The account is needed to access notebooks in Google Colab; while an account isn’t required, it’s strongly recommended to get the benefit of full participation with the exercises. If you’re unable to use Google Colab, a downloadable notebook will be available via a GitHub repo.)

Recommended preparation:

Recommended follow-up:

About your instructor

  • Noah Gift is lecturer and consultant in both the UC Davis Graduate School of Management’s MSBA program and Northwestern’s graduate data science program, MSDS, where he teaches and designs graduate machine learning, AI, and data science courses and consults on machine learning and cloud architecture for students and faculty. These responsibilities include leading a multicloud certification initiative for students. He’s the author of close to 100 technical publications, including two books on subjects ranging from cloud machine learning to DevOps. Noah has approximately 20 years’ experience programming in Python. He’s a Python Software Foundation Fellow, an AWS Subject Matter Expert (SME) on machine learning, an AWS Certified Solutions Architect and AWS Academy Accredited Instructor, a Google Certified Professional Cloud Architect, and a Microsoft MTA on Python. Over his career, he’s served in roles ranging from CTO, general manager, and consulting CTO to cloud architect at companies including ABC, Caltech, Sony Imageworks, Disney Feature Animation, Weta Digital, AT&T, Turner Studios, and Linden Lab. In the last 10 years, he’s been responsible for shipping many new products that generated millions of dollars of revenue and had global scale. Currently, he’s consulting startups and other companies. Noah holds an MBA from UC Davis, an MS in computer information systems from Cal State Los Angeles, and a BS in nutritional science from Cal Poly San Luis Obispo.

Schedule

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

Introduction to Python for DevOps (55 minutes)

  • Lecture: DevOps; procedural statements; lists and dictionaries; functions; lazy expressions; async and concurrency; IPython terminal
  • Group discussion: DevOps; Python; IPython
  • Hands-on exercises: Write a dictionary with a mutable key; write a function that returns infinite random values; 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)

  • Lecture: Reading, writing, and using files—TXT, CSV, and YAML; managing files and directories using os.path and pathlib; walking directory trees using os.walk; getting stat information on files and directories; finding files—duplicates, globbing, and patterns
  • Group discussion: File I/O in Python; searching a filesystem in Python
  • Hands-on exercises: Read and write a YAML file; rename files with pathlib; find files using glob
  • Q&A

Break (5 minutes)

Developing with the command line (55 minutes)

  • Lecture: Setting up a Python project with VSCode and pip; using sys.argv; using Click CLI Framework; Click, subprocess.run, and mixing shell and Python together
  • Group discussion: VSCode; pip; subprocess; command line
  • Hands-on exercise: Write a command-line tool with sys.argv; write a command-line tool with Click
  • Q&A

Break (5 minutes)

Continuous integration and delivery (60 minutes)

  • Lecture: Creating Makefiles; creating Python virtualenv; linting and testing Python code with Pylint and pytest; configuring CircleCI continuous integration with GitHub; continuous delivery
  • Group discussion: Pylint and pytest; CircleCI; continuous integration and delivery
  • Hands-on discussions: Create a Makefile; create and use virtualenv; lint code with Pylint; set up a GitHub repo to build with CircleCI
  • Q&A