Programming languages and DevOps
DevOps is becoming really popular those times, and if you haven’t heard about it you can check out the post here explaining everything you need to know and how to learn DevOps. But if I can sum that up, DevOps helps companies to build, test, release, deploy and monitor software and design the global infrastructure around it. Besides that, we have a lot of automatisation. If you want to be efficient in this field you will have to automate a huge amount of tasks. And for this need, you have scripting languages like bash that can help a lot. Let’s say you want to check that system configuration files are well written and maybe contain certain values. You can do it manually, but if you have a lot of servers it will become time-consuming to do that every morning for example. In this case, you can choose to automate that by writing a script that will facilitate your work.
Ok fine, everything seems perfect but where do we need python then?
Python
To answer this question, we need to consider the different perspectives of the problem. But first of all, python is a programming language ( extremely popular by the way) used everywhere. You can use python to write desktop applications, and web applications, to craft machine learning programmes, … And it has a really big community. It can also be used as a scripting language to solve problems like the one we saw earlier. There are many reasons why you may choose python instead of other solutions like scripting languages.
Python is good at everything
This is the most important aspect of choosing python for DevOps. You can basically do everything with python. And this means that you can automate whatever you want to automate and include almost everything you may need. For example, it can be difficult to automate a complete application flow (end to end testing) with scripting languages like bash. And this is something you can do with less than 15 lines of python. And realize much more than what you can imagine. For example, you can automate the test of the authentication (sign in, sign up, reset password) of an application on different screen sizes with different browsers and all that with a ridiculously small code. This gives you a lot of possibilities.
One tool, multiple usages
As python is made for everything, you can choose python alone as a programming language to automate everything without the need for another tool or programming language. You may write scripts for the operating system, Automated testings, … And also go really far with python. You can also choose for example to include machine learning in your scripting in order the choose the optimal values for each of your configurations depending on your system or program performances. Or to manually monitor systems performance and much more with some python utilities for disk, CPUs, …, or to automate ssh related tasks or to set up continuous integration and continuous deployment or to provision server on the cloud, … (if you want to know more about all those processes let us know in the comments)
Literally, with python, you have endless possibilities
Python is easy
Python is one of the easiest programming languages to learn. The syntax is really natural. So people with no experience as well as senior programmers can get into it very easily and start writing programs. There are a dozen of python courses online for free (like this complete python course from ulife school ). Python has a huge community where you can get help if you are stuck with something. It can be forums like StackOverflow, communities on discord and slack or even blog posts (like this one) or books
There is a really interesting book called Devops for python that you may want to explore. It includes almost everything you can do with python for DevOps with practical examples and use cases.
Python packages
We can also talk about python packages. for almost everything you want to do, you can find a python package that facilitates that. for instance, write files, create web servers, generate passwords, send HTTP requests, test applications, write machine learning programmes, monitor machines, make reports and craft graphs,… no need to reinvent the wheel. Just jump into the community and start writing code.
You can also find snippets implementing things you are trying to do. or sometimes complete codebase. As python is easy to read it will be easier to understand those codes and adjust them to solve your own problems
Conclusion
There are a dozen reasons why you will want to use python for DevOps, we have listed a few but you can find a lot more when learning python or DevOps. For instance, we are offering a 100% free DevOps course here ( including python, docker, Kubernetes, Terraform, Ansible, Jenkins, … ). And if you have some other reasons, you can let us here.
Leave a Reply