O'Reilly logo
live online training icon Live Online training

Python for DevOps - Learn fiercely effective automation

Web Ops & Performance

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 a lecturer in the University of California, Berkeley, graduate data science program, the Northwestern University graduate data science program, and the MSBA program at the University of California, Davis, Graduate School of Management. He consults with startups and other companies on machine learning and cloud architecture and does CTO-level consulting as the founder of Pragmatic AI Labs. Noah has approximately 20 years’ experience programming in Python and is a Python Software Foundation Fellow. Previously, he worked for a variety of companies in roles such as CTO, general manager, consulting CTO, and cloud architect. He’s published over 100 technical publications, including books on cloud machine learning and DevOps, for O’Reilly, Pearson, DataCamp, Udacity, and other publishers. He’s also a certified AWS Solutions Architect. Noah earned an MBA from the University of California, Davis, an MS in computer information systems from California State University, Los Angeles, and a BS in nutritional science from Cal Poly, in San Luis Obispo. You can find more about Noah by following him on GitHub, visiting his website, or connecting with him on LinkedIn.

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