Distutils / Static Metadata

Legacy Wiki Page

This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.

This page discuss the way to separate the metadata in a static PKG-INFO like file.

TresSeaver’s notes

Matthias Klose and I worked on this a bit. We settled on the idea of reusing the ‘setup.cfg’ file, by relaxing the “one section per command” rule to allow spelling more arbitrary metadata.

I commented to reflect work happening in distutils2 –ÉA (Éric Araujo)

In particular, we proposed the following changes:

  • Document use of extra sections, not directly connected to a command.

    • - work in progress (ÉA)

  • Allow expansion of values using ‘${key:value}’ semantics from other sections.

    • Alternative: When passing arguments to commands, pass the whole

      ‘ConfigParser’ (to allow pulling in config from other commands / sections. This is more general, so maybe a “better” choice, but might break backward-compatibility with out-of-core commands.

  • Add new distutils commands, each with their own sections in ‘setup.cfg’ (these sections would break out files currently labeled only as ‘data’ into categories more useful to downstream packageers).

  • Add a distutils command which generates ConfigParser section text (on ‘sys.stdout’) based on values passed to ‘setup()’. This command would provide a migration path for existing distributions, who would capture the output to a file, review it, and then concatenate it onto their ‘setup.cfg’.

  • Eventually, the only thing in ‘setup.py’ for the majority of packages would be:

    • try:

      • from setuptools import setup

      except ImportError:

      • from distutils import setup

      setup() # use the data in setup.cfg

  • The only reason to include ‘setup.py’ at all would be for compatibility with existing docs, etc. The “normal” installation dance might be something like:

    • $ python -m distutils.commands.install

    or a generated script which did the same thing.