Making setup.py clean more useful.
Project description
Extends the clean command to remove stuff generated by the development process.
Wait… Why? What??
So setup.py clean is useful for developers of C extensions or anything else that takes advantage of the setup.py build command. 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 the sdist and bdist* commands
Top-level .egg-info and .egg directories that setup.py creates
Local virtual environment directories
__pycache__ directories
I come from a C/C++ background where the Makefile usually provide house keeping targets such as clean, dist-clean, and maintainer-clean. This extension is inspired by the same desire for a clean working environment.
Installation
The setuptools package contains a number of interesting ways in which it can be extended. If you develop Python packages, then you can include extension packages using the setup_requires and cmdclass keyword parameters to the setup function call. This is a little more difficult than it should be since the setupext package needs to be imported into setup.py so that it can be passed as a keyword parameter before it is downloaded. The easiest way to do this is to catch the ImportError that happens if it is not already downloaded:
import setuptools try: from setupext 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, )
You can use a different approach if you are simply a developer that wants to have this functionality available for your own use, then you can install it into your working environment. This package installs itself into the environment as a distutils extension so that it is available to any setup.py script as if by magic.
Usage
Once the extension is installed, the clean command will accept a few new command line parameters.
- setup.py clean --dist
Removes directories that the various dist commands produce.
Where can I get this extension from?
Source |
|
Status |
|
Download |
|
Documentation |
|
Issues |
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for setupext_janitor-0.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ec7cb77272f81b821b1ad630cf6d850e3549a091d7bb1319ca0063ce33aada3 |
|
MD5 | 3fa5a360d61004e8c85014668f76f6dd |
|
BLAKE2b-256 | 5b5b3f7f0eb2ee22fa57568d8135d310dfc0216d02926049364bc53fbd94b20b |