Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #83743

Re: Using a ChangeLog as a canonical source of package metadata

From Ben Finney <ben+python@benfinney.id.au>
Subject Re: Using a ChangeLog as a canonical source of package metadata
Date 2015-01-14 21:59 +1100
References (1 earlier) <mailman.17465.1420701187.18130.python-list@python.org> <54ae6715$0$12987$c3e8da3$5496439d@news.astraweb.com> <mailman.17488.1420762070.18130.python-list@python.org> <54b2be27$0$13000$c3e8da3$5496439d@news.astraweb.com> <85bnm5ukze.fsf@benfinney.id.au>
Newsgroups comp.lang.python
Message-ID <mailman.17711.1421233195.18130.python-list@python.org> (permalink)

Show all headers | View raw


Ben Finney <ben+python@benfinney.id.au> writes:

> The idea is to parse from the Changelog the version metadata, and
> record it in Setuptools metadata. Then the ‘pkg_resources’ module of
> Setuptools allows programmatic access to that metadata.

One tricky aspect is: at what specific point should the Changelog be
parsed and the version metadata recorded in Setuptools package metadata?

At first I thought it should be done immediately on starting ‘setup.py’,
in order to have values to supply to the ‘setup()’ call. So I imported
the ‘version’ module which itself imports ‘docutils’ to have the reST
parsing available; then ‘setup.py’ continues by feeding the Changelog to
a function which parses it and emits values which are used to supply
parameters to ‘setup()’.

As was revealed in a recent version of the code base, though, this
causes a circular dependency. Docutils is a third-party library, which
needs to be declared as a dependency and satsified before it can be
imported. But that dependency can't be declared until ‘setup()’ has run
to specify what the dependencies are!

So in a later release I've had to break that circle by introducing an
initial “unknown” state for the version information, in order to allow
‘setup()’ to run and get the dependencies installed. Then when the
‘setup.py egg_info’ command is run, the Changelog is parsed and the
version info metadata file is injected into the Setuptools metadata for
the distribution.

Rather more complicated than I would like, because of the need to have
‘setup()’ as a top-level call in ‘setup.py’. This would be more
straightforward if we could assume the commonly-deployed existence of a
*declarative* build system (such as Make); but in Python we're stuck
with ‘setup.py’ and its limitations for now. Fortunately, the hard work
of many people have made those much better in recent years.


I'm interested to know what people writing Python distributions think of
this approach. Again, the example I'm discussing is in ‘python-daemon’'s
code base, at <URL:https://alioth.debian.org/projects/python-daemon/>.

Eventually I might propose this to the Distutils folks as a possible
improvement, but I'd like to refine it more in the face of actual usage.

-- 
 \          “… a Microsoft Certified System Engineer is to information |
  `\     technology as a McDonalds Certified Food Specialist is to the |
_o__)                               culinary arts.” —Michael Bacarella |
Ben Finney

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Announce: PyPrimes 0.2.1a Steven D'Aprano <steve@pearwood.info> - 2015-01-08 04:35 +0000
  Re: Announce: PyPrimes 0.2.1a Ben Finney <ben+python@benfinney.id.au> - 2015-01-08 18:12 +1100
    Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 22:16 +1100
      Re: Announce: PyPrimes 0.2.1a Irmen de Jong <irmen.NOSPAM@xs4all.nl> - 2015-01-08 23:32 +0100
        Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 11:41 +1100
          Re: Announce: PyPrimes 0.2.1a Chris Angelico <rosuav@gmail.com> - 2015-01-09 11:50 +1100
            Re: Announce: PyPrimes 0.2.1a alister <alister.nospam.ware@ntlworld.com> - 2015-01-09 09:05 +0000
              Re: Announce: PyPrimes 0.2.1a Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 22:01 +1100
                Re: Announce: PyPrimes 0.2.1a alister <alister.nospam.ware@ntlworld.com> - 2015-01-09 11:42 +0000
          Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 12:11 +1100
            Re: Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Rustom Mody <rustompmody@gmail.com> - 2015-01-08 17:39 -0800
            Re: Where to learn current best Python packaging practices (was: Announce: PyPrimes 0.2.1a) Rick Johnson <rantingrickjohnson@gmail.com> - 2015-01-08 17:42 -0800
              Re: Where to learn current best Python packaging practices Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 13:37 +1100
      PyPI files should not change their payload (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 10:55 +1100
        Re: PyPI files should not change their payload (was: Announce: PyPrimes 0.2.1a) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-09 11:38 +1100
      Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Ben Finney <ben+python@benfinney.id.au> - 2015-01-09 11:06 +1100
        Re: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-12 05:17 +1100
          Re: Using a ChangeLog as a canonical source of package metadata Ben Finney <ben+python@benfinney.id.au> - 2015-01-12 07:21 +1100
            Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-11 12:37 -0800
              Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-12 05:44 +0000
                Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-12 05:24 -0800
                Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-13 06:59 +0000
                Re: Using a ChangeLog as a canonical source of package metadata wxjmfauth@gmail.com - 2015-01-13 00:09 -0800
                Re: Using a ChangeLog as a canonical source of package metadata Steven D'Aprano <steve@pearwood.info> - 2015-01-13 08:22 +0000
          Re: Using a ChangeLog as a canonical source of package metadata Ben Finney <ben+python@benfinney.id.au> - 2015-01-14 21:59 +1100
      Re: Using a ChangeLog as a canonical source of package metadata (was: Announce: PyPrimes 0.2.1a) Chris Angelico <rosuav@gmail.com> - 2015-01-09 11:16 +1100
  Re: Announce: PyPrimes 0.2.1a Christian Gollwitzer <auriocus@gmx.de> - 2015-01-08 08:27 +0100
    Re: Announce: PyPrimes 0.2.1a Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-01-08 22:20 +1100

csiph-web