How Much Python is Needed for DevOps?

How Much Python is Needed for DevOps?

If you are looking to get into DevOps, but you do not have a background in programming, it is reasonable to ask, how much programming do you need to know as a junior DevOps Engineer? Is Python a requirement? Are there other programming languages that are needed? Here’s what you need to know.

The good news is, as a junior DevOps Engineer you don’t need to be proficient at Python or any other programming language. But you must be comfortable writing and debugging smaller scripts in at least one scripting language like Python, Bash, PowerShell or Ruby.

The DevOps scene is evolving at an incredibly fast pace, as a result, companies rarely look for expertise in a specific technology. To be successful in this field, it is much more important to be able to pick up new languages and technologies quickly. Having said that, if you are absolutely new to the field, Python is a great starting point.

In this article, I’m going to look into why Python is a wonderful tool for DevOps, what are the minimum requirements, how to get started with it and briefly mention some other tools that you’d find helpful.

Can You Become a DevOps Engineer Without Knowing Any Python?

Yes, it’s possible. While Python is extremely popular and many of the DevOps tools are built on it, there are plenty of alternatives, not all organizations rely on Python.

Will you be able to avoid learning python throughout your career? Now, that’s quite unlikely, at some point you will almost inevitably come across some Python code that you’ll have to fix or modify.

And after all, why would you try to avoid it? One of the reasons Python is more popular than its competitors - like Ruby or shell scripting - that it is easier to learn, maintain and work with.

Python is favored because it’s very expressive and simple, yet it’s a powerful, high-level language with an awesome set of data structures.

Python scripts are portable, it is supported on most modern architectures, has a great, mature ecosystem - huge selection of 3rd party packages - and an easy-to-use packaging system.

Python is an interpreted language, which means there’s no compilation-build cycle, which makes developing in python fast and painless, it is perfectly suited for simple scripts with a small scope.

Being an interpreted language does not make it slow, most Python implementations apply a bunch of clever tricks to make it highly performant, close to the level of compiled languages.

Python is very lightweight, it does not require a huge runtime like Java does. It is easy to install as it is available on most systems as a prepackaged binary.

What Is Python Used for in DevOps?

DevOps is all about automation and python happens to be a great fit for that. Cronjobs, alerts, provisioning, build jobs, system monitoring scripts, network management - you name it, Python is a great tool for that.

Traditionally Python has also been used as a high-level language, gluing together prebuilt tools or 3rd party services, so in today’s cloud-first world, it is a great choice for integrating various APIs and cloud service providers. The majority of the DevOps tools you’ll use already has a ready-made Python client library to make your life easier.

Python Basics for DevOps - The Very Minimum That You MUST Know

What are the minimum requirements if you want to work in DevOps? Well, as I mentioned above you do not have to know all the intricacies of the language. You do not need to be able to design or implement huge and sophisticated software systems. Chances are, you will also not need to be able to come up with complex or witty algorithms.

What you need is being able to automate tasks like monitoring, alerting, provisioning, orchestrating and of course, managing configuration and packages. And of course, as you’ll be responsible to keep things running smoothly in your organization, you should be able to implement these things in a reliable, robust and secure manner.

To be able to do that, you’ll need to be familiar with the basics of Python - or your chosen scripting language. Things like the basic syntax, control flow, and data structures. Being familiar with file handling, networking and regular expressions won’t hurt either.

You should also be comfortable with package management and integrating 3rd party libraries, tools, and APIs. You’ll do that a lot.

As your job most probably will be absolutely mission-critical to your organization, it is a good idea to get familiar with at least the very basics of information security.

Later on, you might also want to look into writing automated test suites.

How Much Time Does It Take to Learn the Basics of Python

That’s a tricky question, if you already have some programming experience, you should be able to write useful scripts in less than a week, as the syntax is very simple, Python almost reads like pseudo-code. However, if you are new to coding it can take a bit longer, but I’d still encourage you to start working on some smaller pet projects early on. More on that later.

Of course, mastering Python can take months or even years. You should always strive to learn new tricks, try out new tools, even as an experienced programmer. Learning never really stops, it is very important to keep honing your skills throughout your career, as the IT world is constantly evolving, if you stop improving yourself, you’ll get left behind quite quickly.

How to Get Started With Python

There are a lot of Python courses out there - both free and premium and the official documentation itself is quite good as well. They are great for picking up the basics, but I cannot stress the importance of applying what you’ve learned. Go start a side-project, build your own lab, play around with your own infra. Break things and try to figure out how to fix them as you go. Actually doing stuff will teach you more valuable lessons than any course. As an added benefit you happen to build some interesting stuff you might even have something to put on your portfolio. In the eyes of your potential employer that’s probably worth more than any certificate.

Beyond the Basics

As a junior DevOps engineer, you do not have to know everything about Python. There are a lot of advanced programming concepts that you can pick up on the job, or come back to them later.

The intricacies of OOP, multiple inheritance, decorators and parallel programming are nice to know but probably they are not really essential to your job in the beginning.

What other programming languages are needed for DevOps

Chances are you will come across various other programming languages, for example, you’ll most definitely have to use some shell script at some point in your career. Ruby and Java are also quite common, many of the popular DevOps tools are built on them. If you work with older legacy systems might also come across some Perl scripts, it was quite popular around the 2000s. And of course, JavaScript is adopted by a growing number of organizations, it is pretty hard to get around it if you consider any kind of career in IT.