A handpicked list of the most useful and surprising Python packages from PyPI

Why do we all love Python? For starters, it’s a beautiful and easy-to-learn programming language. Another reason: it comes with batteries included, meaning Python has many excellent libraries included by default. But in my opinion, it’s the 230,000 user-contributed packages that make Python really powerful and popular.

In this article, I handpicked 15 packages that I found most useful during my 10-year career as a Pythonista. Let’s go!

1. Dash

Dash is relatively new. It’s ideal for building data visualization apps in pure Python, so it’s particularly suited for anyone who works with data. Dash is a blend of Flask, Plotly.js, …

#3 — Don’t be clever

A ladder with text 12
A ladder with text 12

I’ve worked with many software developers, some of them fresh out of college and others seasoned professionals. This article lists some of the traits these people seem to have in common.

1. You Aren’t Gonna Need It (YAGNI)

Don’t write code that you don’t need right now. It’s tempting to write some extra code because you think you will need it later on. The problem here is twofold.

  1. You probably don’t need it after all. Now there’s code just sitting there unused, and nobody dares to remove it because who knows what will break if they do.
  2. Unused code does not get updated. It can introduce bugs…

6 ways to increase performance, from using better algorithms to using C to multiprocessing

1. Optimizing your code and algorithms

Always take a good look at your code and algorithms first. You can resolve most speed issues by implementing a better algorithm or adding caching. Entire books are written about this subject, but some general guidelines to follow are:

  • Measure, don’t guess. Measure which parts of your code take the most time to run. Focus on those parts first.
  • Implement caching. This can be a big optimization if you perform many repeated lookups from disk, the network, and databases.
  • Reuse objects instead of creating a new one on each iteration. Python has to clean up every object you created to…

Use these tips to quickly improve your technical writing skills


As a software engineer, you’ll inevitably need to write documentation. Writing documentation is a craft, and it has a name: technical writing. Like regular writing, this is something you can learn and get better at with practice.

For your reference, I consider myself a software engineer first and a technical writer second. I’ve been writing on Medium for two years now. I also write articles for other websites. As a result, I’ve picked up some writing skills along the way!

In this article, I’ll share six tips that you can use to write better documentation or technical articles.

Know Your Audience

First of…

From slotted classes to replacing lists with tuples

Here are 10 advanced Python tricks to up your game and write faster, cleaner code. You may know some of these, but I’m sure there is something to learn here for everyone.

1. Using slotted classes

In a slotted class we explicitly define the fields that our class is allowed to have using the magic field name __slots__. This has some advantages:

  • Objects created from the class will take up slightly less memory
  • It’s faster to access class attributes
  • You can’t randomly add new attributes to objects of a slotted class

Here’s an example of how to define a slotted class:

To me…

Improve your Python knowledge and skills

Here are 30 Python best practices, tips, and tricks. I’m sure they’ll help you procrastinate your actual work, and still learn something useful in the process.

1. Use Python 3

In case you missed it: Python 2 is officially not supported as of January 1, 2020. This guide has a bunch of examples that only work in Python 3. If you’re still on Python 2.7, upgrade now.

If you’re on MacOS, you can use Homebrew to painlessly upgrade Python.

2. Check for a minimum required Python version

You can check for the Python version in your code, to make sure your users are not running your script with an incompatible version. …

With virtual environments, you can isolate your software and avoid version conflicts

Python virtual environments allow you to install Python packages in an isolated location for a particular application instead of installing them globally.

Let’s explore what the advantages are and how you can quickly get started.

Why You Need Virtual Environments

Preventing version conflicts

If you install third-party packages system-wide, you could argue that you’re very efficient. After all, you only need to install it once, saving you precious time and disk space.

There’s a problem with this approach that may start to unfold weeks or months later, however.

Suppose your project, Project A, is written against a specific version of its dependencies. …

There are better ways to manage your packages and virtual environments than using pip and virtualenv

Many developers still use the combination of virtualenv and pip, but most of them probably haven’t heard about pipenv yet. This article introduces pipenv, a better way to manage your Python virtual environments.

Why pipenv?

Using pipenv has several advantages compared to using pip and virtualenv. These are the main ones:

  • You no longer need to use pip and virtualenv separately. Instead, you have one tool that does it all — and more!
  • pipenv separates your top-level dependencies from the last tested combination (e.g., the output of pip freeze). This makes dependency management more user-friendly for you as a developer.
  • pipenv encourages…

Everything you ever need to know about Python dictionaries

Old books
Old books

The dictionary is one of Python’s most powerful data types. In other programming languages and computer science in general, dictionaries are also known as associative arrays. This is because they allow you to associate keys with values.

Creating a Dictionary

Let’s look at how we can create and use a dictionary in the Python REPL:

>>> phone_nrs = { 'Jack': '070-02222748', 'Pete': '010-2488634' }
>>> an_empty_dict = { }
>>> phone_nrs['Jack']

The first dictionary associates keys (names like Jack and Pete) with values (their phone numbers). The second dictionary is an empty one.

Now that you’ve seen how to initialize a dictionary…

If you’re stuck at home, now is the time to polish your skills

1. Create a game

I bet you never considered creating a game with Python. But why not? There are awesome libraries that will help you develop games. So let’s help your kids, your partner, or your colleagues get through this crisis with a fun game!


Pygame is a cross-platform set of Python modules designed for writing video games. It includes computer graphics and sound libraries. Here are a few tutorials you can try:

Erik van Baaren

Software developer by day, writer at night. Webmaster at https://python.land

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store