Extends setupools in order to parse Distutils2 setup.cfg, pip requirements file ... This project is largely inspired by the d2to1 library.
In your setup.py, the only requirement is:
from setuptools import setup setup( setup_requires=['cardhu'], cardhu=True )
Allows you to use a Distutils2 setup.cfg like configuration file:
[metadata] name = cardhu version = 0.1.1 author = Xavier Barbosa summary = Allows using distutils2-like setup.cfg files for a package's metadata with a distribute/setuptools setup.py keywords = setup distutils [files] packages = cardhu
This lib also allows to hook your setuptools commands:
# local hook [install] pre-hook.cardhu = cardhu.hooks.pre_install post-hook.cardhu = cardhu.hooks.pre_install # global hook [entry_points] cardhu.pre_hooks = install = cardhu.hooks:pre_install develop = cardhu.hooks:pre_develop
This lib expose more features, for example, the development requirements will be automatically installed when using python setup.py develop
:
[metadata] requires-dev = docutils >= 0.3
Or the same before running a test:
[metadata] requires-test = py.test
Goals:
- Implement the full Distutils2 setup.cfg files
- Implement the Distutils2 resources, based on the sysconfig module.
- Make
python setup.py (develop|install|tests)
more easy, by loading requirements files:- requirements-{dev|test}-{target_version}.txt
- requirements-{dev|test}.txt
- requirements.txt
- extends the -r keyword to git and mercurial in order to create the last revision number (https://pythonhosted.org/setuptools/setuptools.html#tagging-and-daily-build-or-snapshot-releases)
- Automate changelog.rst and authors.rst files completion.
Incompatibilities:
- Options with environment markers are not implemented yet.
Currently implemented:
some of the distutils2 keywords
entry_points
backport from distutils:[entry_points] distutils.setup_keywords = cardhu = cardhu.core:cardhu
setup(cardhu=True) will loads distutils2 setup.cfg parts
Command hooks: https://pythonhosted.org/Distutils2/distutils/commandhooks.html:
# file: myhooks.py def my_install_hook(install_cmd): print("Oh la la! Someone is installing my project!")
[install] pre-hook.project = myhooks.my_install_hook
Custom ConfigParser, in order to play well with multi values.
Distutils2 do not support extra_require keyword (https://pythonhosted.org/setuptools/setuptools.html#declaring-extras-optional-features-with-their-own-dependencies), so added this under:
[metadata] requires-extra = reST = docutils >= 0.3 python_version >= "2.7" = six foo
see http://alexis.notmyidea.org/distutils2/setupcfg.html, Distutils2
see ...