cft

9 Python Packages You Should (Probably) Know

Use what others have already improved to boost your project.


user

Fernando Souza

3 years ago | 4 min read

Python is an amazing and versatile programming language. You can build a variety of applications, from web scrapping to beautiful desktop app.

And in most of the time, you will only need the standard library to execute your tasks. But sometimes, using an extra package can be very useful, to abstract a functionality and save you precious time.

In this article I am going to list some packages you might want to consider for your next project.

The idea is to show some nice projects out there that you might not (yet) know. Maybe they can inspire you in some way to create a new project.

Note: these are packages that I have used at least once in my projects. There are a lot of others good ones out there that are out of this list. You can see a good list here.

Eve

If you are using MongoDB and want to create a REST API for your database, you need to check the Eve framework. Built on top of Flask, another famous web framework, you can create various endpoints for your resources using a dictionary or a configuration file.

You can configure features such as pagination, filtering, customize endpoints, authentication, versioning, and many others.

And being powered by Flask, you can still use the whole flask extensions that are available in the community to extend your project.

FastAPI

Still in the world of web frameworks, there is the fantastic FastAPI. It is built on top of Starlette and Pydantic packages, using modern Python features as type hints and async / await.

It is many cool features, such as data validation, middleware, file upload, GraphQL, and WebSockets, that you can easily configure and use.

And it automatically generates a OpenAPI page so you can test your API without a third-party application.

If you need to create an API, this is library you should definitely check out.

Streamlit

If you have once created a data science project, you might have struggled on how to share your results. Or maybe even wasted a lot of time fighting with JavaScript and CSS to get an awful page in the end.

Streamlit is a wonderful Python library that helps you create beautiful web apps without having to deal with all the Javascript. Only Python.

It has many components already created for you, so that you only focus on creating the presentation of your data.

Pandas Profiling

Creating a new web app to show your data science project might be too much for you. You might want a simple report for your Pandas dataframe or just show the results of some basic calculations you have performed on them.

The package pandas-profiling is perfect for that. It expands the pandas function df.describe() generating an interactive HTML report that contains statistics such as:

  • Histogram;
  • Descriptive value, like mean, mode, standard deviation, etc;
  • Correlation;
  • Missing values;
  • And many others

It is great as well to get a preview for your dataframe to see what you can do or to get a preliminary analysis.

Manim

If you want to create animations, not only for math, this is definitely the library to use.

It was created by Grant Sanderson to animate the videos for his YouTube channel 3Blue1Brown (if you don’t know yet, you should). It started as a side project, but now has a nice community that helps maintaining it.

You can create animated videos with a few lines that will certainly help you visualize or illustrate a problem you have.

Or just for the fun.

Typer

If you want to create a command line interface application, you should check Typer.

Developed by the same creator of FastAPI, it uses the package Click (that you should also check, by the way) and expands it.

It creates the parsers and the arguments directly from the arguments of your function, with the help of python type hints.

import typer


def main(name: str):
typer.echo(f"Hello {name}")


if __name__ == "__main__":
typer.run(main)

If you have ever used argparse or getopt, you will be happy of how easy it is to use Typer.

ZeroRPC

It is a flexible implementation of RPC based on ZeroMQ and MessagePack. It means you can execute a remote Python function as if it was locally in your package.

It doesn’t matter if your code is in the same machine, in another machine in the same network, or in a cloud server in a remote country. ZeroRPC can expose and execute your code as if it is local.

You can even use the command line to expose an existing Python code without having to modify it.

If you need to create a distributed system, consider checking this package.

MkDocs

Creating a great documentation for your project is an important step if you want other people to use it.

You can use MkDocs to create a beautiful HTML page from markdown files. It is fast, simple, and can be extended with your own theme.

All the pages are written using markdown and the documentation is generated using a simple YAML configuration file. After that, you can serve your static files as a beautiful web page.

Huey

Huey is a lightweight task queue system with a simple API. It supports multiple features, such as:

  • Multi-process, multi-thread or greenlet task execution models.
  • Schedule tasks to execute at a given time, or after a given delay, or to be recurring, like a crontab.
  • Task prioritization
  • Task locking
  • Task pipelines and chains

You can add a function to be enqueue with a simple decorator. It’s definitely worth a look.

Conclusion

Although Python has a wide range of libraries and functions that are already inside its standard library, sometimes you might need to use an external one.

This is not an ultimate list, as there are hundreds of other great packages out there (check this github page with some inspiration).

Check them out. Even if you decide not to use, or don’t need them at all, you might get inspired by their code and create another cool package.

If you know a nice package that is not listed here, leave a comment.

Upvote


user
Created by

Fernando Souza


people
Post

Upvote

Downvote

Comment

Bookmark

Share


Related Articles