Rodolfo De Nadai

10 python packages you cant live without...

Posted 535 day(s) ago
   

Ok, firsts things frist...

Python has something like, more than 80k packages... im pretty sure there are a lots of packages that i don't know or even undestand.
So this is a simples and compreensive list of packages that i like and use, like a lot, or from time to time.


requests

if you are a python developer you must have used requests. It a great package that exposes a simple api to connect and get http responses.
It is so good, that i already heard people saying that is a reference in how to build a api.

I think last year requests was almost merged into the core python, but due to more rapidly updates the requests team decided to not merge the project to core python.

import requests

r = requests.get('http://www.google.com.br')
if r.status_code == 200:
    print(r.text)

Pillow

Perhaps one of the few packages that people know that exists, but doens't use a lot.
Pillow is a fork of the good (but old) PIL (Python Image Library) library. When PIL stop receiving updates some great members of the python community decided to fork the old lib and implement from that a new one with new features.
If you ever need to work with images... give Pillow a change, is very good at what it does.

from PIL import Image

im = Image.open("lena.ppm")
box = (100, 100, 400, 400)
# crop image
region = im.crop(box)
region.show()

cython

Lots of people complain about python performance. The Cython project could speed up you code with just a fewer modifications.
The point here is using cython to convert python code to C...

A great project, with a great usage widespread....

nltk

This one of the few libs in python that i find very special, nltk stands for Natural Language Toolkit. A lib to make Natural Processing in python very easy.
If you need to work with lots of texts, perhaps this library can help you.

import nltk

sentence = '''Just a simple frase to make words. Also check out the stopwords function in nltk'''
tokens = nltk.word_tokenize(sentence)

numpy

numpy is the most used language in python for science, people normally doesn't use directly, but other projects use.
Numeric python had a long way to get to the point it is, a very stable library and one the python recently success. Without numpy and scipy, a guess python for data science wouldn't happen!

import numpy as np

zeros_matrix = np.zeros( (3,4) )

scikit-learn

I think this is the best lib i ever seen... machine learning is a new hype in technology nowdays... and scikit-learn is the way to go here.
Install and use it... but keep in mind this is a hard field, but very, very interesting one.

skyfield | astropy

Those two libs are to work with astronomy, since i enjoy astronomy a lot, those two comes in vary handy time.
You can use both to lots of things... i use to calculate position of planets and sattelites, but there's lots more.

django

One of the most python packages installed and in use. Web development in python is very good, and frameworks like django (and flask) can provide a lots of ready to use thins.
I find django orm very useful thing, template also is good.

boto

Amazon nowdays is almost like a must use feature, and to use amazon ec2 the boto library is the way to go. Simple and to the point, boto library can be very easily integrated into your software.

ipython

Just like numpy | scipy the ipython notebook took python to data science in a easy to use way. I think most of data science people use the notebooks from time to time.
Its easy to develop a python application and docs... you could even share the notebook to others, and can run almost all python libs in it.
Damn, nowdays you can even run other languages like Julia!!!


So, if you didn't know all or some of the libs above, i hope that you go ahead and check them out, it will make you software skills go to a higger level.
And if you got the time, is good to study the internals of the libs to even contribute to them!


 Django python