Skip to content

Python-Based Tools#

Beyond its data science uses, Python can also be used to install development tools. This article covers installing those tools in a manner consistent with the Iron Law of Python Management.

pipx#

pipx enables you to put Python tools with command-line interfaces in isolated environments.

First, install pipx:

For server installations, you will use one of the server versions of Python to install pipx. You must also provide the --user flag so that pipx is only installed for your account.

Terminal

$ /opt/python/3.9.2/bin/python -m pip install pipx --user
$ /opt/python/3.9.2/bin/python -m pipx ensurepath

Using your pyenv global version of Python, install pipx and then rehash to make pyenv aware of it:

Terminal

$ python -m pip install pipx
$ python -m pipx ensurepath
$ pyenv rehash

Black, a Python tool for formatting code, is a good example of a tool you might want to install this way--you may want to format Python code across several Python projects without installing it into each project.

Terminal

WDAGUtilityAccount@mvp MINGW64 ~/Documents/python-examples (master)
$ pipx install black
  installed package black 20.8b1, Python 3.9.2
  These apps are now globally available
    - black-primer.exe
    - black.exe
    - blackd.exe
done! ✨ 🌟 ✨

Confirm that it worked:

Terminal

WDAGUtilityAccount@mvp MINGW64 ~/Documents/python-examples (master)
$ black --version
black, version 20.8b1

Notebooks#

Notebooks are a popular interface for editing Python data science code. Read more about how to use them here.

The Jupyter extension in VS Code is another way to work with notebooks.

Conda#

Conda is a package and environment manager which you can use to follow many of the strategies outlined in this series. However, many data science packages can be installed easily without it.