The 22 Most-Used Python Packages in the World - Better Programming

By Erik-Jan van Baaren

508M downloads

Docutils is a modular system for processing plaintext documentation into useful formats, such as HTML, XML, and LaTeX. Docutils is able to read plain text documents in the reStructuredText format — an easy-to-read markup syntax similar to MarkDown.

You probably have heard about PEP documents, or even read one. So what is a PEP document? The very first PEP document called PEP-1 explains it well for us:

PEP stands for Python Enhancement Proposal. A PEP is a design document providing information to the Python community, or describing a new feature for Python or its processes or environment. The PEP should provide a concise technical specification of the feature and a rationale for the feature.

PEP documents are written in a fixed reStructuredText template, and converted using docutils to nicely formatted documents.

Docutils is also at the core of Sphinx. Sphinx is used to create documentation projects. If Docutils is a machine, Sphinx is the factory. It was originally created to build Python documentation but many other projects use it to document their code.

You’ve probably read documentation on readthedocs.org, right? Most of the documentation on there is created by Sphinx and docutils.

13. Chardet

501M downloads

You can use the chardet module to detect the charset of a file or data stream. This can come in useful when analyzing big piles of random text, for example. But it can also be used when working with remotely downloaded data where you don’t know what the charset is.

After installing chardet, you also have an extra command-line tool called chardetect, which can be used like this:

chardetect somefile.txt
somefile.txt: ascii with confidence 1.0

You can also use the library programmatically, check out the docs.

Chardet is a requirement for requests and many other packages. I don’t think many people use chardet on its own, so its popularity must come from these dependencies.

14. RSA

492M downloads

The rsa package is a pure-Python RSA implementation. It supports:

  • encryption and decryption,
  • signing and verifying signatures,
  • key generation according to PKCS#1 version 1.5.

It can be used as a Python library as well as on the command-line.

Some facts:

  • The letters in RSA are initial letters of the surnames of Ron Rivest, Adi Shamir, and Leonard Adleman. They described the algorithm in 1977.
  • RSA is one of the first public-key cryptosystems and is widely used for secure data transmission. In such a cryptosystem, there are two keys: a public part and a private part. You encrypt data with the public key, which can then only be decrypted with the private key.
  • RSA is a slow algorithm. It is less commonly used to directly encrypt user data. Often RSA is used to securely pass a shared key for symmetric key cryptography, which is much faster at encryption and decryption of large amounts of data.

The following code snippet show how RSA can be used for a very simple use-case:

Assuming Bob kept his private key private, Alice can be sure that he is the only one who can read the message.

Bob, however, does not know for sure that it was Alice that sent the message since anyone can get and use his public key. To prove it was her, Alice could have signed the message with her private key. Bob can verify this signature with her public key, ensuring it was really her sending the message.

Packages like google-auth (#37), oauthlib (#54), awscli (#17) depend on the rsa package. Not many people will be using this one as a stand-alone tool since there are faster, more native alternatives.