As far as I know, it just removes the the build
subdirectory, where Python puts all the files to be installed, including extensions that need to be compiled.
There shouldn't be any *.pyc
files elsewhere, unless you ran Python on some scripts in the source directory (which may happen if you run tests), or imported modules directly from the source directory.
*~
files are emacs backup files, and thus wouldn't be cleaned up by setup.py
anyway. (If you've seen this behaviour from make clean
, than that's simply because someone coded that into the Makefile.)
You probably could override the clean command in a way to (recursively) remove *.pyc
files, but I doubt if there's a need. In general, Python is smart enough to recompile *.py
files into *.pyc
files if the former have changed, and otherwise using the latter will simply be faster.
There is one caveat I've come across, and that is when doing a setup.py build_ext --inplace
, cleaning won't remove the compiled module(s), since these are not in the build directory. Which to me feels like shortcoming of the clean command.
Overall, it looks like the clean command was added to be in line with make
's behaviour, but it doesn't seem to add much.