I’ve been writing Python for a long time now. Here are some tools I’ve found to be more productive along the way.
If you use Pipenv, Pip, or Virtualenv to manage your projects, I highly recommend you switch to Python Poetry. Poetry manages your virtual environments and dependencies on a per-project basis that yield reproducible builds. It is similar to Pipenv but has a few advantages:
Poetry is a great way to install some of the other tools on this list as development dependencies with
poetry add -D [name].
Since I’ve been writing Rust, I have missed static type-checking in Python. It can catch a lot of errors before they happen. Mypy is a way to actually do something useful with the type annotations in Python.
Unlike many languages, Python has an official style guide (please use it).
Flake8 is your guide to achieving PEP-8 compliance.
When you run
flake8, it will point out where there are style issues.
If you don’t agree with some rules or find them a hinderance like I do, you can put a file called
.flake8 in your project root to disable them:
[flake8] ignore = E402, E501
Organized import statements can also make your code look better.
I use isort in pretty much all of my Python projects.
isort . and it’ll sort your imports, it’s very easy.
Bandit is made by the same group as isort. It checks your codebase for common security issues. Bandit checks for many types of security errors, including this made using Django and Flask. Running a single command is a small price for some peace of mind.
This one is a website, not a program.
It’s an easy way to generate
.gitignore files so that you don’t commit files that no one else cares about (or maybe too much about, such as private keys and passwords).
Just type in the languages, frameworks, libraries, editors you use and it will generate a nice
.gitignore for you.