Distutils/setup.py Command Plugins¶
Command classes for Distutils/setup.py to assist with Python package building/usage/management.
For basic BumpCommand
usage, see either the class documentation itself, or the bump
module
documentation.
Registering distutils commands in setup.py
Below is a very basic setup.py showing how to load the commands BumpCommand
and ExtrasCommand
into setup.py, so they can be used via ./setup.py bump
and ./setup.py extras
respectively.
from setuptools import setup, find_packages
from privex.helpers import settings, BumpCommand, ExtrasCommand
# For BumpCommand, specify the file which contains "VERSION = '1.2.3'"
settings.VERSION_FILE = '/home/john/mypackage/mypackage/__init__.py'
# For ExtrasCommand / extras_require, you may wish to change EXTRAS_FOLDER if you want to store your
# extras requirements.txt files in a different folder structure.
# By default, EXTRAS_FOLDER is 'extras' (a folder, relative to the current working directory)
settings.EXTRAS_FOLDER = 'requirements/extras'
# Load the extra requirements files requirements/extras/cache.txt and requirements/extras/tests.txt
extensions = ['cache', 'tests']
setup(
extras_require=extras_require(extensions),
cmdclass={
'bump': BumpCommand,
'extras': ExtrasCommand,
},
);
Classes
|
Distutils/setup.py command class for bumping the package version using |
|
Distutils/setup.py command for managing package extras, including displaying/saving requirements, installing them, and more. |