[Distutils] Alternate static metadata PEP submission...
David Cournapeau
david at ar.media.kyoto-u.ac.jp
Wed Oct 21 10:49:52 CEST 2009
Chris Withers wrote:
> The thing is, there's just no need for all this code to be in setup.py.
>
> For me, anything more than:
>
> from xxx import setup
> setup()
>
> ...in the case where all the information is in setup.cfg is totally
> unacceptable.
FWIW, I have played a bit with something in that direction - this is not
a suggestion for anything at that point, just a toy prototype to play
with some ideas I have concerning a new distribution tool in python:
http://github.com/cournape/toydist
The basis is a static file format, but richer that the proposed PEP 390:
- the goal is to be able to describe fully a package from the static
data: meta-data, packages, doc, extensions, etc...
- converting from existing setup.py to a static file is possible
through an API (one could have a distutils command to automatically
generate such a file)
- a two lines toysetup.py can build basic packages from an existing
toysetup.info static file
- for the majority of packages out there (the ones which do not
extend distutils, basically), the passage setup.py -> toysetup.info ->
toysetup.py should be "lossless". This is huge IMHO, because it provides
a transition to a system which does not depend on distutils anymore.
An example of the static file is:
"""
Name: hello
Version: 1.0
Library:
BuildRequires: paver, sphinx, numpy
if os(windows)
BuildRequires: pywin32
Packages:
hello
Extension: hello._bar
sources:
src/hellomodule.c
if os(linux)
Extension: hello._linux_backend
sources:
src/linbackend.c
"""
The corresponding setup.py is simply:
"""
from distutils.core import setup
from toydist import parse_static
info_dict = parse_static('toysetup.info').to_dict()
setup(**info_dict)
"""
The format is basically a rip-of from cabal (haskell distribution
format) at this point,
cheers,
David
More information about the Distutils-SIG
mailing list