Show where a Python package is used

June 11, 2015

A while back I was doing some spring cleaning of my Python packages. I noticed that there were a bunch of packages that I couldn’t recall installing. I wanted to know if I could safely remove them, so I wrote a simple bash script to tell me called pip-uses.

Source

Rather than post the source here and let it get more out of date every time I change it, you can find the source on GitHub. It’s in my bin repository, where I keep my notable helper scripts; feel free to poke around.

Motivations

I was primarily influenced by Homebrew’s brew uses command. It does a nice job of giving you exactly the information you want, and I think the way the command is named makes sense.

Homebrew: brew uses
$ brew uses --installed pango
imagemagick

pip-uses gives you basically the experience:

Pip: pip-uses
$ pip-uses stevedore
virtualenvwrapper

In this example, the Python package virtualenvwrapper uses stevedore, just as imagemagick uses pango. Both commands can save you from accidentally removing a crucial dependency and answer the burning question, “How in the world did this thing get installed?”

Wish List

I’m not doing much Python development these days, but if I had some spare time I’d love for the script to also have these features:

If you find this script useful and end up implementing one of these feature or more on top of pip-uses, be sure to send me a Pull Request!

Read More

Surgery on codebases from the CLI

One problem that comes up all the time for me is needing to manipulate files only on specific lines. Like, “find and replace this pattern, but only on specific lines.” In this post, I’ll introduce the CLI tools I’ve made to solve this class of problems with some examples. Continue reading

On Programming Language Choice

Published on June 21, 2019

Notes on Continuations

Published on June 18, 2019