Package: setupext-janitor
Extends thecleancommand to remove stuff generated by the
development process.Wait… Why? What??Sosetup.py cleanis useful for developers of C extensions or
anything else that takes advantage of thesetup.py buildcommand.
Pure Python packages generate their own set of artifacts that clutter
up the source tree.  This package extends the clean command so that
it removes the following artifacts as well:The distribution directory as generated by thesdistandbdist*commandsTop-level.egg-infoand.eggdirectories thatsetup.pycreatesLocal virtual environment directories__pycache__directoriesI come from a C/C++ background where theMakefileusually provide house
keeping targets such asclean,dist-clean, andmaintainer-clean.
This extension is inspired by the same desire for a clean working
environment.InstallationThesetuptoolspackage contains a number of interesting ways in which
it can be extended.  The simplest way to use this extension is to install
it into the environment and use it.  The package extends thecleancommand by installing adistutils extension:$ pip install -q 'setupext-janitor'
$ ./setup.py clean --dist --eggs
running clean
removing './my_package.egg-info' (and everything under it)
removing 'dist' (and everything under it)You can also install the command from within yoursetup.pyusing thesetup_requiresandcmdclasskeyword parameters to thesetupfunction call.  This is a little more difficult than it should be since
thesetupext_janitorpackage needs to be imported intosetup.pyso
that it can be passed as a keyword parameterbeforeit is downloaded.
The easiest way to do this is to catch theImportErrorthat happens
if it is not already downloaded:import setuptools
try:
   from setupext_janitor import janitor
   CleanCommand = janitor.CleanCommand
except ImportError:
   CleanCommand = None

cmd_classes = {}
if CleanCommand is not None:
   cmd_classes['clean'] = CleanCommand

setup(
   # normal parameters
   setup_requires=['setupext_janitor'],
   cmdclass=cmd_classes,
   entry_points={
      # normal parameters, ie. console_scripts[]
      'distutils.commands': [
         ' clean = setupext_janitor.janitor:CleanCommand']
      }
)This approachis not recommendedsince theinstall_requireskeyword
will installsetupext_janitorinto a target environment when installing
your package from a source distribution.  Not to mention that amount of
gynmastics required to safely use it from withinsetup.py,UsageOnce the extension is installed, thecleancommand will accept a
few new command line parameters.setup.py clean--buildRemoves directories that variousbuildcommands produce.setup.py clean--distRemoves directories that the variousdistcommands produce.setup.py clean--eggsRemoves.eggand.egg-infodirectories.setup.py clean--environmentRemoves the currently active virtual environment as indicated by the$VIRTUAL_ENVenvironment variable.  The name of the directory can
also be specified using the--virtualenv-dircommand line option.setup.py clean--pycacheRecursively removes directories named__pycache__.setup.py clean--allRemove all of by-products.  This is the same as using--dist--egg--environment--pycache.Where can I get this extension from?Sourcehttps://github.com/dave-shawley/setupext-janitorStatushttps://travis-ci.org/dave-shawley/setupext-janitorDownloadhttps://pypi.org/project/setupext-janitorDocumentationhttp://setupext-janitor.readthedocs.io/en/latestIssueshttps://github.com/dave-shawley/setupext-janitor