10 Libraries Python Programmers Need to Know About

By John Paul Mueller

Python provides you with considerable power when it comes to creating average applications. However, most applications require some sort of special processing to make them work. That’s where libraries come into play.

One of the best places to find a library listing online is the UsefulModules site. Of course, there are many other places to look for libraries as well. For example, the article entitled “7 Python Libraries you should know about” provides you with a relatively complete description of the seven libraries its title refers to. Libraries are everywhere.

Develop a secure environment using PyCrypto

Data security is an essential part of any programming effort. Part of protecting the data is to ensure that no one can steal it or use it in a manner that the originator didn’t intend, which is where cryptographic libraries such as PyCrypto come into play.

The purpose of this library is to turn your data into something that others can’t read. The purposeful modification of data in this manner is called encryption. However, when you read the data into memory, a decryption routine takes the mangled data and turns it back into its original form so that the application can manage it. You need the key, which is used to encrypt and decrypt the data.

Interact with databases using SQLAlchemy

The most common type of database is called a Relational DataBase Management System (RDBMS), which uses tables that are organized into records and fields. Each field is part of a column of the same kind of information, such as the customer’s name. Tables are related to each other in various ways, so creating complex relationships is possible.

An RDBMS relies on a special language called the Structured Query Language (SQL) to access the individual records inside. Of course, you need some means of interacting with both the RDBMS and SQL, which is where SQLAlchemy comes into play. This product reduces the amount of work needed to ask the database to perform tasks.

See the world using Google Maps

Geocoding has lots of uses in the world today. Getting from one place to another often revolves around geocoding. Google Maps lets you add directional data to your applications.

Google Maps can also help in Geographic Information System (GIS) applications. Google Maps presents your application with a look at the outside world that it can use to help your user make decisions.

Add a GUI using TkInter

Users respond to the Graphical User Interface (GUI) because it’s friendlier and requires less thought than using a command-line interface. Many products can give your Python application a GUI. However, the most commonly used product is TkInter. Developers like it because TkInter keeps things simple. It’s actually an interface for the Tool Command Language (Tcl)/Toolkit (Tk). A number of languages use Tcl/Tk as the basis for creating a GUI.

Provide a nice tabular data presentation using PrettyTable

Displaying tabular data in a manner the user can understand is important. Python stores this type of data in a form that works best for programming needs. However, users need something that is organized in a manner that humans understand and that is visually appealing. The PrettyTable library makes it easy to add an appealing tabular presentation to your command-line application.

Enhance your application with sound using PyAudio

One of the better platform-independent libraries to make sound work with your Python application is PyAudio. This library makes it possible to record and play back sounds as needed.

The reason to use a platform-independent library is to ensure that your application provides basic sound support on all systems that it might interact with.

Manipulate images using PyQtGraph

Getting tabular information onscreen is difficult, which is why you need a library such as PyQtGraph to make things simpler.

PyQtGraph supports both 2D and 3D displays, and you can use it to generate new graphics based on numeric input. The output is completely interactive, so a user can select image areas for enhancement or other sorts of manipulation. In addition, the library comes with a wealth of useful widgets.

PyQtGraph isn’t a free-standing library, which means that you must have other products installed to use it. You need these items installed on your system to use it:

Locate your information using IRLib

Having some type of search capability built into your application is important so that users can find a lost file or other information.

The problem with most search libraries is that they are hard to install or don’t provide consistent platform support. However, IRLib is written in pure Python, which ensures that it works on every platform.

IRLab works by creating a search index of whatever information you want to work with. You can then save this index to disk for later use. The search mechanism works through the use of metrics — you locate one or more entries that provide a best fit for the search criteria.

Create an interoperable Java environment using JPype

You might be in a situation in which you find a Java library that is a perfect fit but can’t use it from your Python application unless you’re willing to jump through a whole bunch of hoops. The JPype library makes it possible to access most of the Java libraries out there directly from Python. The library works by creating a bridge between the two languages at the byte-code level.

Access local network resources using Twisted Matrix

Depending on your network setup, you may need access to files and other resources that you can’t reach using the platform’s native capabilities. In this case, you need a library that makes such access possible, such as Twisted Matrix. The basic idea behind this library is to provide you with the calls needed to establish a connection, no matter what sort of protocol is in use.