Like most other programming languages, Python has strong third-party support that provides a wide variety of tools. These tools can greatly enhance Python’s capabilities during application creation. A debugger is a tool because it is a utility, not a library, which is used to create better applications.

Even if we separate tools from non-tools (such as libraries), the number of tools does not decrease significantly. Python is supported by a large number of general and specialized tools, which are grouped into the following 13 categories:

  • Automated refactoring tools;

  • Bug tracking tools;

  • Configuration and build tools;

  • Deployment tools;

  • Document tools;

  • Integrated development environment;

  • Python debugger;

  • Python editor;

  • The Python Shell;

  • Skeleton Builder;

  • Testing software;

  • Useful modules;

  • Version control.

It’s worth noting that the list on the Python DevelopmentTools page is incomplete. In addition, you can also find a number of Python tools on other web pages.

Today, I have selected a few tools that need special attention. If you’re interested in Python tools, you can find other tools online to learn about. You may find that some of the tools you want to build already exist, and more than one.

1 Use Roundup Issue Tracker to track bugs

There are a number of bug-tracking sites available: Github, Google Code, BitBucket, Launchpad. However, these public sites are often not as easy to use as your own custom localized bug-tracking software. There are several tracking systems you can choose from on your local machine, but the Roundup Issue tracker is one of the better ones. Roundup runs on all Python-enabled platforms and provides the following basic functionality:

  • Bug tracking;

  • Manage the TODO list.

If you’re willing to put a little extra effort into installation, you’ll get more features that make Roundup different from other products. However, to get these capabilities, you may need to install other products, such as a database management system (DBMS). Roundup’s product instructions tell you what to install and which third-party products it is compatible with. Once installed, you’ll get the following features.

  • Customer support, including:

  • Telephone answering wizard;

  • Network link;

  • System and develop problem tracking tools.

  • Problem management of Internet Engineering Task Force (IETF).

  • Sales trend tracking.

  • Submission of conference papers.

  • Double blind review management.

  • Blogs (currently rudimentary, will become powerful).

2 Create a virtual environment using VirtualEnv

There are many reasons to create a virtual environment, but the main reason is to create a safe, known test environment. Using the same test environment every time ensures that your application has a stable test environment until you have done enough testing in a product-like environment. VirtualEnv provides a way to create a virtual Python environment that you can use for early testing or to diagnose problems caused by the environment. Keep in mind that you need to do at least 3 standard level tests.

  • Bug: Checks for errors in a program.

  • Performance: verify whether the program meets the requirements of speed, reliability and security.

  • Availability: Verifies that the program meets user requirements and responds to user input the way users expect it to.

Based on the way most Python applications are used, Python applications usually do not need to run in a virtual environment in a real working environment. Most Python applications require access to the external environment, but the virtual environment prevents this external access behavior.

Never test a program on a production server

A common mistake some developers make is to test an unreleased program on a production server, making it easily accessible to users. Never test your program on a production server for a number of reasons, the most important of which is data loss. Permanent loss or corruption of data can result if users are allowed access to an unreleased program that contains bugs that could corrupt the database or other data sources.

Be aware, too, that you only get one chance to win someone’s favor. Many software projects fail because users eventually abandon them. Even if the application is complete, no one will use it because the user thinks the application is flawed in some way. Users have only one goal in mind: get the job done as quickly as possible and go home. When users discover that an application is wasting their time, they will stop using it.

In addition, unreleased apps can have security holes that malicious people can exploit to gain illegal access to your network. It doesn’t matter how great your security software is if your door is open and anyone can get in. When they come in, it’s almost impossible to get rid of them, and even if you do get rid of them, the damage to the data has already occurred. Recovering from a security breach is difficult and sometimes impossible. In short, never test your application on a production server, it’s too expensive to do so.

3 Install your application using PyInstaller

In general, users don’t want to spend too much time installing an application, no matter how much it will ultimately help them. Even if you can get the user to try to install the program, the less computer-literate user will probably fail to install it. In short, you need a foolproof way to help users install programs smoothly on their computers. PyInstaller helps you do this by generating an installation package for your application that users can use to easily install programs on their own systems.

Fortunately, PyInstaller works on all Platforms that support Python, so you only need one tool for all your installation needs. In addition, you can get platform-specific support if necessary. For example, on Windows, you can create executable files with code signatures. Mac developers love that PyInstaller provides support for bundles. For the most part, try to avoid using platform-specific features unless you really need them. When you use platform-specific features, the installation will only succeed on that platform.

Don’t use isolated tools

Some Python tools on the network are isolated and no longer supported by their developers. But some developers still use these tools because they like the features they support or the way they work. This is risky, however, because you cannot be sure that the tool will work with the latest version of Python. When choosing tools, try to choose tools that are fully supported by the manufacturer.

If you must use isolated tools (for example, only isolated tools are available to do a job), make sure the tools you use are still well supported by the community. Maybe the manufacturer of the tool no longer exists, but at least there is a community that can provide you with useful information when you need support. Be aware that using unsupported tools can waste a lot of your time because they may not work properly. |

Many of the installation tools we find online are platform specific. For example, when you are looking for an installation tool that creates executables, you need to be aware that the executable created by the tool is platform-specific (at least on the platform you specify). It’s important that the installation tool you choose works everywhere, so you don’t create packages that users can’t use. It doesn’t matter what cross-platform language you use if you have problems installing packages.

Create developer documentation using pDOC

There are two kinds of documents related to an application: user documents and developer documents. User documentation describes how the application is used, while developer documentation describes how the application works. Libraries require only one kind of documentation, developer documentation, whereas desktop applications require only user documentation. However, a service may require both documents, depending on who the user is and how the service is put together. Most documentation will probably affect developers, and pDoc is a simple solution for creating it.

The PDOC utility uses docstrings and comments that you insert into your code to create documents, whose output is either a text file or an HTML document. You can also have pDoc run as a Web server so that people can view documents directly in a browser. Pdoc is actually a replacement for EpyDoc, and epyDoc’s founders no longer support EpyDoc.

What is a docstring?

The docstring is a special comment, enclosed in triple quotes, as follows:

"""This is a docstring."""

You can associate a docstring with an object, such as a package, function, class, and method. In Python, any code object you create can have a docstring. The purpose of docstrings is to describe objects, so use descriptive statements.

The easiest way to view the docstring is to use the doc() method after the object name. For example, typing print(myclass.doc ()) will display the docstring for MyClass. In addition, you can use help(such as help(MyClass)) to access docstrings. Good docstrings indicate what an object does, not how it does it.

In addition, third-party utilities can use docstrings. With the right utilities, you can document an entire library without having to do it yourself. The utility you use will create documents from docstrings in the library. Thus, even though docstrings and comments serve different purposes, they are equally important in Python code.

Write program code using Komodo Edit

When choosing an IDE, it depends on the developer’s needs, skill level, and type of application to create. When it comes to certain types of application development, some ides are better than others. The best IDE to use for novice developers is Komodo Edit. You can download the IDE for free, and it contains rich features that give you a much better coding experience than using IDLE. Here are some of the features that Komodo Edit provides:

  • Support for multiple programming languages;

  • Keyword auto-completion;

  • Indent check;

  • Project support, automatically generate part of the program code;

  • Well supported.

However, Komodo Edit differs significantly from other ides in that it provides an upgrade path. When you find that Komodo Edit no longer meets your needs, you can upgrade to the Komodo IDE, which includes support for many professional-level features, such as code analysis (the ability to check application speed) and database browser (which makes databases easier to use).

6 Use Pydbgr to debug programs

High-end ides such as Komodo IDE come with a full debugger, and even Komodo Edit comes with a simple debugger. However, if you choose a smaller, cheaper IDE with fewer features, you may not see a debugger at all. The debugger can help you find errors in your program and fix them. The better the debugger, the less work it takes to find and fix errors. If you’re using a code editor that doesn’t come with a debugger, make sure you find an external debugger, such as Pydbgr.

A good debugger includes many standard features, such as code coloring (using colors to represent things like keywords). In addition, different debuggers also have some non-standard features that make them different from each other. Here are some of pydbgr’s standard and non-standard features. Pydbgr can be a good choice if you’re using a code editor that doesn’t come with a debugger.

  • Intelligent evaluation: Evaluation commands help us understand what happens when a line of code is executed, before it actually runs in the program. It helps us do what-if analysis to understand where problems might occur in the program.

  • Cross-process debugging: Generally speaking, we can only debug applications that reside on the same machine. In fact, the debugger is part of the application process, which means that the debugger itself can interfere with the debugging process. To do this, we can use cross-process debugging so that the debugger doesn’t affect the application, and you don’t even have to run the application on the same machine as the debugger.

  • Full bytecode checking: Sometimes it helps to see how code is converted to bytecode (code that the Python interpreter really understands).

  • Event filtering and tracing: When your program runs in the debugger, it generates events that help the debugger understand what is happening. For example, moving to the next line of code generates one event, returning from a function call generates another, and so on. With this capability, we can control how the debugger tracks the application and what events it reacts to.

7 Use IPython to enter the interactive environment

The Python Shell works well for many interactive tasks. However, if you’ve used it, you’ve probably noticed that it has some flaws. The biggest drawback is that the Python Shell is a plain text environment, where you have to type commands to perform a given task. More advanced shells, like IPython, support GUI interfaces, which make the interaction environment more friendly so you don’t have to memorize all sorts of weird commands.

In fact, IPython is much more than a simple Shell. It provides an environment in which you can interact with Python in new ways, such as graphically displaying the results of formulas you create in Python. In addition, IPython is a front-end that accommodates other languages. The IPython application sends commands to the real Shell in the background, so you can use shells in other languages, such as Julia and Haskell. (Even if you’ve never heard of them, don’t worry.)

One of the most exciting features of IPython is its ability to work in a parallel computing environment. Most shells are single-threaded, which means you can’t do any parallel computation, and you can’t even create a multithreaded environment. For this feature alone, IPython is worth a try.

8 Test Python applications using PyUnit

At some point, you need to test your applications to make sure they work as expected. When testing, you can either test by typing commands one at a time and verifying the results, or automate the process. Obviously, it’s better to automate this approach, because you don’t want to spend all your time testing and not even have time to go home for dinner, and manual testing is very, very slow (especially if you make a mistake, which is bound to happen). Tools like PyUnit greatly simplify the process of unit testing (testing a single feature).

The advantage of PyUnit is that it allows you to create real Python code to perform tests. Simply put, the script you write is another specialized program that tests the main application for problems.

You might think that scripts (applications that you don’t write specifically) are full of bugs. In fact, test scripts are often designed to be very simple, which greatly reduces errors in the scripts and makes them easy to find. Even so, mistakes sometimes occur. So, when you can’t find a problem in your application, you really need to check the script.

9 Use Isort to collate code

Cleaning up code may seem like a small thing, but if you don’t pay attention to it, your code can get messy, especially if you don’t put all the import statements alphabetically at the top of the file. In some cases, if your code isn’t clean enough, it’s hard (not impossible) to figure out what’s going on with it. The Isort utility only sorts import statements and makes sure they are all at the top of the source code file, which may seem trivial, but will go a long way toward understanding and modifying the source code.

Sometimes just knowing which modules are required for a particular module can help us quickly identify potential problems. For example, if you have an older version of a module installed on your system, knowing which modules are required by your application can make the process of finding that module much easier.

In addition, it is important to know which modules your application needs when distributing it to users. Only if the required modules are installed on the user’s system can the program work as expected.

10 Use Mercurial for version control

None of the applications you’ve created in the course of studying this book are really complicated. In fact, after you finish reading this book and move on to more advanced studies, you’re unlikely to even need version control. However, versioning becomes very important when you are working in an organized development environment and actually developing applications that meet user needs. Simply put, versioning is keeping track of the different versions of a program that are released into the actual production environment and recording the changes that occur between them. When you say you are using MyApp 1.2, you are referring to version 1.2 of the MyApp app. It makes sense to put a version mark on a program to let people know which version they are using when bugs have been fixed or improvements have been made.

There are many Python versioning tools, but one of the more interesting ones is Mercurial. Mercurial is available on almost every platform where Python can be run, so you don’t have to worry about not being able to use Mercurial when you switch platforms. (For your platform, if Mercurial doesn’t provide an executable, you can download the Mercurial source code from the official site and build one yourself.)

Unlike other products, Mercurial is free. Even if you plan to move to other, more advanced products later, you can gain useful lessons from managing a project or two using Mercurial.

Source code management (SCM) refers to storing versions of an application in different places so that changes made to the source code can be undone or redone as needed. Source code management can seem like a daunting task to many people. Mercurial is a fairly friendly environment where you can learn about SCM. The source code for each version of the application must be available when you need to go back to an older version of the application or fix a problem in a newer version.

The best thing about Mercurial is that it has a great online tutorial. The best way to learn ABOUT SCM is to follow it step by step on your own machine, even if it’s just to look through the materials. The first part of the tutorial is about installing Mercurial. Then, the tutorial shows you how to create a repository (where versions of the application are stored) and use the repository when creating application code. By the end of this tutorial, you will have a good understanding of how source control works and why version control is an important part of application development.

This article is excerpted from Learning Python from Scratch, 2nd edition

Learning Python from Scratch (2nd Edition)

By John Paul Mueller

Translator: Wu Chuanhai

Editor’s Recommendation:

  • “Got Talent Fans” is a classic book brand that has been selling well in the United States for nearly 30 years and has been tested by hundreds of millions of readers.

This book for zero basic readers, skillfully use analogical description, easy to grasp the technical knowledge; This tutorial is based on case studies, so you can easily understand the programming thinking and explore Python programming techniques in the accompanying code. This book contains 5 common tasks &2 advanced tasks to help you quickly learn Python.

In addition, the book also contains a series of Python trivia tips to help you learn and use Python better.

More Python book lists are recommended

Python Programming without A Teacher

By Cory Althoff

Amazon in the United States, there is a highly influential Python introduction book, Kindle version in the United States amazon website in the computer software, software development category ranked the first, beyond many solid Python books, many five-star praise. As you may have heard, this book is Called Python Programming without A Teacher: The Making of a Professional Programmer.

The author is a self-taught programmer. As a liberal arts student, he taught himself programming, mastered programming skills and got a job as a software engineer at eBay. This book is written from the author’s personal experience to help the reader grow from a layman to a professional Python programmer.

Python Programming from Beginner to Master

Author: Ye Weizhong

This book explains the Python language development technology step by step, from simple to deep, and drills the specific use process of each knowledge point through concrete examples. The book consists of 23 chapters, of which chapters 1 and 2 are the basic knowledge, explaining the basic knowledge of Python language development, including setting up the development environment and basic syntax introduction. Chapters 3 through 9 are the core technical sections, covering simple data types, operators and expressions, conditional statements, loop statements, working with lists, working with tuples, dictionaries, and collections, and working with functions. These are some of the most important aspects of Python syntax. Chapter 10 ~ 15 is the knowledge advanced part, respectively explained the object-oriented (above), object-oriented (below), file operation processing, exception handling, regular expression, multi-thread development knowledge.




Python Programming (3rd edition)

Author: John Zelle

Python 3 is a classic introduction to programming. This book teaches computer programming using Python as a tool. The book emphasizes problem solving, design, and programming as core skills in computer science. The book is easy to read and learn, with its distinctive features and interesting examples. It is suitable for beginners of Python, as well as for college computer science teachers and students.




Data Structures (Python)

Author: Kenneth A. Lambert

In computer science, data structure is an advanced course with abstract concepts and great difficulty. The Syntax of Python is simple and interactive. Using Python to explain topics like data structures is easier and clearer than, say, C.

Chapter 1 of The Python Language Description of Data Structures briefly introduces the basics and features of the Python language. Chapter 2 to chapter 4 of abstract data types, data structure and complexity analysis, arrays, and linear chain table structure has carried on the detailed introduction, chapters 5 and 6 of object-oriented design is mainly introduced the related knowledge, including chapter 5 of the key differences between interface and implementation, the polymorphism and the content such as information hiding, chapter 6 covers the relevant knowledge of the inheritance, Chapters 7 through 9 introduce linear collections, represented by stacks, queues, and lists. Chapter 10 covers various tree structures, chapter 11 covers sets and dictionaries, and Chapter 12 covers graphs and graph processing algorithms. At the end of each chapter, review questions and case studies are provided to help readers consolidate and think.




Get Started with Python Programming — Automate tedious Tasks

Author: Al Sweigart

Nowadays, most tasks faced by people can be accomplished by writing computer software. Python is an interpreted, object-oriented, dynamic data typed high-level programming language. With Python programming, we can solve many real-world tasks.

This book is a hands-on guide to Python programming. The purpose of this book is not only to introduce the basics of the Python language, but also to teach the reader how to apply this knowledge and skills through hands-on projects. The first part of the book covers basic Python programming concepts, and the second part covers a number of different tasks that a computer can do automatically by writing Python programs. Each chapter of Part 2 has some project procedures for the reader to follow. At the end of each chapter, problem sets and in-depth practice projects are provided to help you consolidate what you have learned. The appendix provides solutions to all the problem sets.




Python Core Programming (version 3)

Author: Wesley Chun

Python Core Programming (3rd Edition) is a new and updated version of the classic bestselling book Python Core Programming (2nd Edition), which is divided into three parts. Part 1 covers some general applications of Python, including regular expressions, network programming, Internet client programming, multithreaded programming, GUI programming, database programming, Microsoft Office programming, and extending Python. Part 2 covers topics related to Web development, including Web clients and servers, Web programming related to CGI and WSGI, Django Web frameworks, cloud computing, and high-level Web services. Part 3 is a supplementary/experimental chapter, covering text processing and a few other things.




– END –