Table of Contents
This is where packages come into play. Packages allow you to organize modules in the hierarchical structure. The way Python organizes packages and modules like the Operating System structures the folders and files. To create a package, you create a new folder and place the relevant modules in that folder.
Top 10 Python Packages Every Developer Should Learn
There are more than 200,000 python packages in the world (and that’s just counting those hosted on PyPI, the official Python Package Index). With so many packages out there, which are the most important ones that every Python programmer needs to learn?
To help answer that question, here’s a list of the most important and useful Python packages that you should familiarize yourself with.
You can do basic mathematical operations without any special Python packages. However, if you’re going to do any kind of complex math, the NumPy package will make your coding life much easier.
NumPy provides tools to help build multi-dimensional arrays and perform calculations on the data stored in them. You can solve algebraic formulas, perform common statistical operations, and much more.
While NumPy is a valuable Python package for a variety of general-purpose programming tasks, it’s particularly important if you want to do machine learning, since it provides part of the foundation for libraries like TensorFlow.
If you have at least a little Python programming experience, you probably know that you can use the datetime module to manage dates and times within an application.
While datetime is great for basic work along these lines, the Pendulum Python package makes it easier to do more complex coding involving dates and times. It manages time zones automatically.
Best of all, Pendulum is designed to be a drop-in replacement for datetime. That means you can use it with code you’ve already written based on datetime.
#3 Python Imaging Library
If your Python application interacts with images in any way, the Python imaging library, also known as PIL or Pillow, is a Python must-have package. It makes it easy to write code that opens, modifies, and saves images in a variety of formats.
If you are doing more advanced work with images (like image recognition, in which case OpenCV would be a good package to consider),but for basic image importing, manipulation, and exporting, Pillow is the best solution.
MoviePy is to videos what Pillow is to images. It provides a range of functionality for common tasks associated with importing, modifying, and exporting video files. It also lets you do things like insert titles into videos or rotate videos 90 degrees.
Like Pillow, MoviePy is not intended as a tool for advanced data manipulation. If you are writing a video editing app, you will probably also need to rely on OpenCV to provide the advanced functionality that MoviePy lacks. But for most standard tasks involving videos in Python code, MoviePy gets the job done quite well.
Writing code that sends HTTP requests can be tricky because HTTP does not exactly format data in a way that is easy for humans to read.
The Requests Python package tackles this problem by automating many of the tedious tasks that you would otherwise need to perform in order to send HTTP requests from your application. It removes the need to add query strings, or do POST form encoding. It also keeps connections with HTTP servers alive automatically, eliminating the need to write a bunch of code for doing that.
In short, if your application sends any data over HTTP, Requests is a must-have package.
There are a variety of packages designed to develop a Python app with Graphical User Interface (GUI) But I think most Python developers would agree that Tkinter is the most important and most commonly used framework for creating GUIs. It binds Python to the TK GUI toolkit, which works on virtually every modern operating system.
The preceding sentence notwithstanding, PyQT, another Python package for building GUIs, is also a strong contender. It provides bindings to the Qt toolkit, which is also cross-platform. It’s intended for heavier-duty GUI programming than Tkinter. That means that PyQT may be overkill if you’re building an app that has a pretty simple interface — say, just a window with some buttons and text fields , but it is a good tool if you want to build a complex, multi-dimensional GUI.
Pandas helps you manipulate and analyze large sets of data without having to learn a specialized data-processing language like R.
Pandas has its limits in that it’s not intended for advanced statistical modelling . But if you need to do things like process time-series data or perform statistical analysis on a data set, Pandas get it done.
For Windows Python programming in particular, Pywin32 is a must-have package. It provides access to many of the native Windows API functions, allowing you to do things like interact with the Windows registry, use the Windows clipboard, and much more.
Pywin32 won’t do you much good if you’re building a cross-platform Python app, but Windows developers might find that they like it so much that they use it instead of native Windows tooling.
If you have a Python development project of any complexity, being able to perform testing on new code is essential. The Pytest package provides a variety of modules to help you do this. Whether it’s a simple unit test or a more complex functional test, Pytest can help you write it.
How to List Installed Python Packages
The Pip, Pipenv, Anaconda Navigator, and Conda Package Managers can all be used to list installed Python packages. You can also use the ActiveState Platform’s command line interface (CLI), the State Tool to list all installed packages using a simple “state packages” command.
If your favorite Python library or framework didn’t make this list of the top ten must-have Python packages, don’t take offense. The Python ecosystem has generated so many valuable packages that it would be impossible to include all of the important ones even on a top 100 list, let alone a top 10 list. Still, for general-purpose Python programming, the packages described above often come in handy.