
Hi, Habrozhiteli! We have published a book based on the
online guide of the same name and containing the work of numerous professionals and enthusiasts who know what Python is and what you want from it.
This guide is not intended to teach you the Python language (we will provide links to many good resources to help you with this), but rather is a (peremptory) specialist guide that discusses popular tools and best practices of our community. The audience for this book is diverse - from newbies to mid-level Python programmers who either want to contribute to the development of open source software (software), either start a career or create a company and are going to write in Python (however for ordinary Python users also Part I and Chapter 5 will be helpful.
In the first part of the book, we’ll talk about how to choose a text editor or an interactive development environment that works for you (for example, readers who often use the Java language may prefer Eclipse with a built-in Python plugin). In addition, other interpreters are considered that satisfy those needs for which you could not even assume that Python can handle this (for example, there is an implementation of MycroPython based on the ARM Cortex-M4 chip). The second part demonstrates the “Python” style of code extraction of examples, adopted in an open source community. Hopefully this style will inspire you to explore and experiment with open source. The third part briefly discusses the wide range of libraries most frequently used in the Python community to help you get an idea of ​​what tasks Python can solve at the moment.
')
Excerpt from a book. Continuous integration
No one will describe the process of continuous integration better than Martin Fowler.
Fowler advocates the use of good tone rules in software design. He is one of the main supporters of continuous integration . This quote is taken from his article on continuous integration. He conducted a series of workshops on test-driven development and extreme development , along with David Heinemeier Hansson, creator of Ruby on Rails) and Kent Beck (Kent Beck, initiator of the movement of extreme programming (XP), one of whose main principles is continuous development).
The three most popular tools for continuous integration at the moment are Travis-CI, Jenkins and Buildbot (listed in the following sections). They are often used with Tox, a Python tool for managing virtualenv and tests from the command line. Travis helps you work with several Python interpreters on the same platform, and Jenkins (the most popular) and Buildbot (written in Python) can manage builds on several machines. Many also use Buildout (discussed in the “Buildout” subsection of the “Insulation Tools” section in Chapter 3) and Docker (discussed in the “Docker” subsection there) for quick and frequent building of complex environments for battery tests.
Tox. Tox is an automation tool that provides the functionality of packaging, testing, and deploying software written in Python from a console or a continuous integration server. It is a common command-line management and test tool that provides the following functions:
• checking that all packages are correctly installed for different versions and interpreters of Python;
• running tests in each environment, configuring selected testing tools;
• acts as a frontend for continuous integration servers, reducing patterning and combining tests for continuous integration and tests for the shell.
You can install Tox with pip:
$ pip install tox
System administration
The tools shown in this section are designed to monitor and control systems (server automation, system monitoring and flow control).
Travis-ci
Travis-CI is a distributed continuous integration server that allows you to create tests for open source projects for free. Provides several workflows that run Python tests, and seamlessly integrates with GitHub. You can even tell him to leave comments for your requests for inclusion if this particular set of changes breaks the build. Therefore, if you place your code on GitHub, Travis-CI is a great way to start using continuous integration. Travis-CI can collect your code in a virtual machine running Linux, OS X or iOS.
To get started, add the file in the
.travis.yml extension to your repository. As an example of its contents, we give the following code:
language: python python: - "2.6" - "2.7" - "3.3" - "3.4" script: python tests/test_all_of_the_units.py branches: only: - master
This code indicates to test your project for all listed versions of Python by running a given script, the build will be performed only for the master branch. There are many options available such as notifications, previous and next steps, and many
others . To use Tox with Travis-CI, add the Tox script to your repository and change the line with the
script: construction; The file should look like this:
install: - pip install tox script: - tox
To activate testing for your project, go to the
site and log in with your GitHub account. Next, activate your project in the profile settings, and you are ready to go. From now on, tests for your project will run after each code is sent to GitHub.
Jenkins
Jenkins CI is an extensible continuous integration engine, currently considered the most popular. Powered by Windows, Linux and OS X, it can be connected to "every existing source code management tool." Jenkins is a Java servlet (equivalent to WSGI applications in Java) that comes with its own servlet container, which allows you to run it using the
java command - jar jenkins.war . For more information, see the
Jenkins installation instructions; The Ubuntu page contains information on how to host Jenkins based on Apache or Nginx reverse proxy.
You interact with Jenkins using the HTTP dashboard or its RESTful API1 (for example,
http: // myServer: 8080 / api ), which means that you can use HTTP to communicate with Jenkins from remote machines. For example, take a look at the
Jenkins Dashboard for Apache or
Pylons .
Python
-jenkins , created by the
OpenStack2 team, is most commonly used to interact with the Jenkins API in Python. Most Python users configure Jenkins to run the Tox script as part of the build process. For more information, refer to the documentation for an
address on how to use Tox for Jenkins, as well as the Jenkins setup
guide for working with multiple machines.
Buildbot
Buildbot is a Python system designed to automate the compile / test cycle that checks for code changes. Similar to Jenkins in that the version control system manager polls for changes, builds and tests your code on multiple computers according to your instructions (has built-in support for Tox), and then tells you what happened. It runs on a Twisted web server. If you need an example of how the web interface will look like, take a look at the Chromium
buildbot public information panel.
Since Buildbot is written in pure Python, you can install it with pip:
$ pip install buildbot
Version 0.9 has a REST
API , but it is still in beta testing, so you cannot use it unless you explicitly specify the version number (for example,
pip install buildbot == 0.9.00.9.0rc1 ). Buildbot has the reputation of being the most powerful and most complex tool for continuous integration. To get started with it, refer to this great
guide .
About the authors
Kenneth Reitz is the owner of the Python product at Heroku and Fellow at the Python Software Foundation. He is widely known for his open source projects, and especially for Requests: HTTP for Humans.
Tanya Schlusser (Tanya Schlusser) cares for her mother, who has Alzheimer's disease, works as an independent consultant, using these metrics to make strategic decisions. She spent many hours teaching students and corporate clients how to work with data.
»More information about the book can be found on
the publisher's website.
»
Table of Contents
»
Excerpt
For Habrozhiteley 25% discount coupon -
Python