Santiago Profile picture
I tell stories about technology and teach hard-core Machine Learning at https://t.co/iZifcK7n47. YouTube: https://t.co/pROi08OZYJ

Sep 26, 2020, 12 tweets

I do a lot of Python 🐍, but you knew that already, right?

However, there's something new: the libraries and tools that I use on every single project. Every. Single. One.

Here are 10 of them. The best ones.

🧵👇

1⃣bpython — A lightweight interpreter

I constantly use the interpreter to test ideas or review the syntax of what I want to do.

bpython is a great alternative to the standard REPL. It offers syntax highlighting, expected parameter list, auto-indentation, and autocompletion.

👇

2⃣rope — A refactoring library

A free utility for refactoring Python code. I personally use it integrated with @code, but you can also use it directly by writing scripts.

This @realpython article discusses rope and refactoring in general: realpython.com/python-refacto…

👇

3⃣flake8 — Enforcing style consistency

This is the first library I install on every project. It's a linter that ensures that my code follows good conventions.

This library is a must, especially for teams.

And it supports third-part extensions!

flake8.pycqa.org/en/latest/

👇

4⃣black — Formatting my code

If flake8 is the first library I install, black is number two.

It's a tool to automatically format my code. It does so keeping compatibility with a standard style guide. I also use it integrated with @code.

github.com/psf/black

👇

5⃣venv — Virtual environments

Every Python developer should master virtual environments and use them for every project.

There are several ways to create virtual environments but since Python 3.3, I mostly use the standard venv module.

docs.python.org/3/library/venv…

👇

6⃣logging — The standard logging facility

It might be time to stop cluttering your code with print statements and start using logging like a grown-up 😋

logging is a standard Python module.

You can find more information in this @realpython article: realpython.com/python-logging/

👇

7⃣sphinx — Generating documentation

Whenever I need to package all my docstrings as a nice HTML documentation site, I go to sphinx.

There are a ton of things about sphinx! It took me some time to get the hang of it, but now I constantly use it.

sphinx-doc.org/en/master/

👇

8⃣pytest — For testing my code

I do a lot of TDD, so pytest is always there with me.

It's very simple to get started with it. At the same time, it's very robust, extensible, and so far, I've found everything I ever needed right there.

Site: docs.pytest.org/en/stable/

👇

9⃣coverage — Understanding your test coverage

The library determines which lines of your code are executable, and which have been executed by the tests.

It gives me an idea of how much code is currently not exercised by my pytest suite.

github.com/nedbat/coverag…

👇

🔟faker — Generating fake data

I discover faker very recently, and it's great! You can use it to generate all sorts of fake data that you can use as part of your tests or for whatever you need.

There's even a pytest plugging which is a bonus!

github.com/joke2k/faker

👇

Let me know what are the libraries and tools that you always use in your projects. I'm always looking for ways to improve this setup!

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling