title: Custom code on pip uninstall
body: <p>I want to run some custom code when I run <code>pip uninstall</code>, cleaning up files that were created on installation. How should I go about this?</p>
  
  <p>I've got custom install code running by using the following in setup.py:</p>
  
  <pre><code>from setuptools import setup
  from setuptools.command.install import install
  
  class CustomInstallCommand(install):
    def run(self):
      #Custom code here
      install.run(self)
  ...
  setup(
    ...
    cmdclass = {
      'install':CustomInstallCommand
    }
  )
  </code></pre>
  
  <p>But trying something similar for <code>setuptools.command.uninstall</code> or <code>from setuptools.command.install import uninstall</code> fails, since those modules/names don't exist.</p>