The application of "column" Python in DevOps

Source: Internet
Author: User

In the age of the Internet, it is only by being able to quickly test new ideas and deliver business value safely and reliably in the first time to remain competitive. DevOps-respected technology practices such as automated build/test/deployment, and system metrics are essential in the Internet age.

Hello everybody, I am Yu Hongchun, of course many people are more familiar with is my net name "Fuqin boiled Wine".

I have been working in e-commerce website and large CDN system for more than more than 10 years, in the Linux cluster, automation operation and maintenance, system security and high-concurrency high-traffic website architecture design and so on in-depth research, in a number of first-line practice accumulated rich experience.

At the same time, I insist on documentation, is 51CTO and Chinaunix and other well-known community of invited experts, 51CTO System network channel columnist, Chinaunix Forum "cluster and high Availability" and "Monitoring and automation operations" version of the moderator, in the community published a large number of technical articles, praised by netizens. Haha, introduce oneself also quite embarrassed.

The application of Python in DevOps

Automated builds (that is, continuous integration of CI) are easy to apply and, if they are Python applications, because of the presence of tools such as Setuptools, Pip, Virtualenv, and TOX, automated builds are straightforward. And because almost all Linux versions have built-in Python interpreters, you can automate with Python without the need for the system to pre-install any software.

For automated testing, the Python-based robot framework enterprise application's favorite automated testing framework is language-neutral. Cucumber also has a lot of supporters, python corresponding to the lettuce can do exactly the same thing. Locust (Locust, an open source load testing tool based on Python development) has also begun to receive more and more attention in automated performance testing. In addition, the rising star selenium, now the most fire-lightweight framework for Web automation testing has now been applied by more and more companies. The main feature of selenium is its open source, cross-platform and numerous programming language support, we can write test cases in Python, but also Java, PHP and even shell.

Automated operations (automated configuration Management) tools, New Generation Ansible, Saltstack, and lightweight, automated operations tool fabric are all developed in Python. The fabric is more lightweight and modular than the previous two, so it is loved by research colleagues and big data colleagues. In addition, these Python automation operations tools can easily be developed two times, so more and more developers are welcome, many companies use them at the same time to complete the automated operation and maintenance work.

The familiar Pythone Web frameworks, such as Django and flask, can quickly design restful APIs that meet the needs of back-end development, especially the lightweight flask, which we choose to use flask in many of the big data external API packages. The feeling is very light and simple. In addition, Python provides richer support for today's AWS and Docker, such as the famous Boto3 and Docker-py, all of which can help you work productively with DevOps.

Why we chose Python

Python's elegance and simplicity is undoubtedly the biggest attraction for research and Development engineers, and in a python interactive environment, execute import this and read the Python zen, and you'll see why Python is so appealing. The Python community has been very dynamic, and unlike the node. JS Community Package explosion, Python's package has been growing at a steady pace, with a relatively high quality package. A lot of people have criticized Python for being too demanding on spaces, but it is because of this requirement that Python has an advantage over other languages when it comes to large projects. This is also evidenced by the total number of OpenStack projects over 2 million lines of code.

For operations engineers, Python's biggest advantage is that almost all Linux distributions have a Python interpreter built in. While the shell is powerful, it has many drawbacks: The syntax is not elegant enough, it does not support object-oriented, has no rich third-party library support, and it can be painful to write complex system tasks, especially when it comes to network HTTP and concurrency tasks. Replacing the shell with Python, doing some complex tasks that the shell does not realize, is a liberation for the operation engineer, the operation and maintenance development.

The advantage of Python is that it is a powerful glue language, especially for Web back-end and server development, for DevOps developers, who are accustomed to call it a kind of, the following advantages:

  1. Python's code style is simple and easy to maintain, including grammatical advantages do not write curly braces, code comments style Unified, emphasizing the only way to do a thing
  2. With a rich web open source framework, the mainstream includes web2py,, Zope2, Pyramid, Django, CherryPy, and lightweight framework flask.
  3. Cross-platform capability, support mac,linux,windows and so on.
  4. Python can be used more than third-party libraries and modules, suitable for a variety of work scene requirements, easy to use.
  5. The Python community is very active and can basically find all the answers you need in its community.
Why we chose Python at work

In the normal DevOps development work, although I will use the shell to handle a lot of work flow, but many times the shell still has the time, this time the advantage of Python to play out, for example in these aspects: Automation operations, design back-end restful API, Complex monitoring scripts, Web application projects, and more. The more we use Python, the more we like to use it.

For these reasons, what other reason do we not choose python?

Practical skills and experience sharing

I also hope that in their own devops practice to refine the actual combat skills and experience, take this column of opportunity to share with you, I hope you can learn, can master Python's actual combat skills and experience, improve professional skills, more efficient in the devops work.

This column currently includes three sides of the content:
First, Python in operation and maintenance work in combat skills;
Second, the Python Automation operation and Maintenance tool in the work of the actual combat;
Third, the combination of Python and Docker.

All the content is from the work summary and actual combat, mainly to help you quickly improve, the learning that is used, learned the knowledge and skills can be quickly used in working practice, to help everyone improve efficiency at the same time, I hope to let you have a strong interest in python, and further spend time and energy to learn it.

Column link Address: HTTP://BLOG.51CTO.COM/CLOUMN/DETAIL/13

The application of "column" Python in DevOps

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.