[Python-Dev] Distutils ML wrap-up: setup.cfg new format (original) (raw)

M.-A. Lemburg mal at egenix.com
Thu Sep 24 10:55:24 CEST 2009


David Lyon wrote:

On Wed, 23 Sep 2009 09:49:16 +0200, "M.-A. Lemburg" <mal at egenix.com> wrote:

While it's a good idea to put up some form of meta-data into an index, I wonder why you are using setup.cfg for this.

setup.cfg has traditionally been used to configure distutils, not to define meta-data. As such you wouldn't want to put such a configuration file up on PyPI. Wouldn't it be better use a new file for this (with the same syntax), e.g. metadata.cfg ?! This would then just contain the meta data that needs to be published. Forgive me if I answer this from being on the distutils-ml but it is easy to answer and might save somebody else time. Currently, the metadata is stored within setup.py and the biggest issue with that is maintaining the version number. For instance, getting the same version number to go into the documentation files, etc. So consensus was that keeping that information in setup.py is somewhat cumbersome and putting it somewhere else would be better. Tarek suggested setup.cfg and it seems to make the most sense.

So the idea is to make the setup() parameters settable via the setup.cfg as well ?! (+1 on that) Or are you suggesting that the setup.cfg file be the only place to set the version number ? (I'd be -1 on that, because you often need to determine the version number dynamically, e.g. when doing snapshot releases)

In my experience, it's usually better to place all the setup() keyword parameters into a separate module which can then be loaded by other tools as well - see e.g. egenix-mx-base for what I mean:

http://www.egenix.com/products/python/mxBase/#Download

The setup.py module itself then just loads this configuration module and uses the values from it to fire off distutils.

By moving the metadata values into a configParser format file, it would mean that external scripts could more easily access/update the version number as required.

Of course, setup.cfg wouldn't get uploaded. Nobody would want to do that. But distutils would create the .PKGINFO file and metadata from configuration, and not from hardcoded string values within setup.py as it does now.

I lost you there... if you have the setup.py file available, where is the problem in running "python setup.py somecommand" to extract the metadata into some other file ?

As far as I understood Tarek's summary, the idea was to have a separate file with just the metadata to upload to PyPI in order to have tools working on the PyPI index extract that metadata without having to download the whole installation package.

That's a very good idea.

The only problem I saw was the name of the file that Tarek chose and whether or not he was actually referring to the setup.cfg used for configuring distutils or not.

-- Marc-Andre Lemburg eGenix.com

Professional Python Services directly from the Source (#1, Sep 24 2009)

Python/Zope Consulting and Support ... http://www.egenix.com/ mxODBC.Zope.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/


::: Try our new mxODBC.Connect Python Database Interface for free ! ::::

eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/



More information about the Python-Dev mailing list