<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#ffffff" text="#000000">
    On 16/03/2011 12:53, Barry Warsaw wrote:
    <blockquote cite="mid:20110316125334.4510b10d@neurotica" type="cite">
      <pre wrap="">On Mar 16, 2011, at 12:39 PM, Alexander Belopolsky wrote:

</pre>
      <blockquote type="cite">
        <pre wrap="">I was editing the turtle module (for issue11571, if you are
interested) when I noticed that it has the following line:

_ver = "turtle 1.1b- - for Python 3.1   -  4. 5. 2009"

This is obviously out of date and this variable is not used anywhere
in the module.  I would simply delete it, but I wonder if there is any
recommended mechanism for maintaining module versions.

Some modules define __version__ which has a special meaning at least
for pydoc and possibly some third party tools.  In many cases it is
never updated and its format and meaning varies from module to module.
(For example, decimal module stores the version of the spec rather
than the version of the module in __version__.)

In several instances, __version__ is set to "$Revision$" in an
apparent attempt to leverage VCS to keep it up to date, but this does
not seem to work after hg transition.  For example,

$  ./python.exe -m pydoc pydoc
..
VERSION
   $Revision$

The other affected modules are pickle and tarfile.

Do you have an advise on how these issues should be handled?
</pre>
      </blockquote>
      <pre wrap="">
MvL and I had a discussion about this at the sprint.  I am planning on writing
an informational PEP that proposes __version__ as a standard convention.  I'd
like to be able to do:

    &gt;&gt;&gt; import foo
    &gt;&gt;&gt; foo.__version__

It won't be mandatory (thus the informational PEP), but it should be
formalized as the preferred way to introspect a module for its version
number.  I think there should be ways to spell this easily if the information
is provided to packaging/distutils2 so that it can basically always be kept up
to date without violating DRY.

</pre>
    </blockquote>
    <br>
    +1<br>
    <br>
    There is a minor difficulty with distutils2 which needs to be able
    to install from setup.cfg without executing code. This means it
    can't look in package.__version__ to get the version number
    (potentially requiring you to maintain __version__ both in your
    package and your setup.cfg).<br>
    <br>
    The suggestion is that the version metadata should be created at
    package build time, defaulting to package.__version__. The rationale
    is that it is ok to execute code at build time if it removes the
    need for information duplication or for executing code at install
    time.<br>
    <br>
    Also note that there is a proposed api for getting version info:
    pkgutil.get_version(module). Under the hood this looks for
    __version__ as one of the first places to find version info.<br>
    <br>
    All the best,<br>
    <br>
    Michael Foord<br>
    <br>
    <blockquote cite="mid:20110316125334.4510b10d@neurotica" type="cite">
      <pre wrap="">-Barry
</pre>
      <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Python-Dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Python-Dev@python.org">Python-Dev@python.org</a>
<a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/listinfo/python-dev">http://mail.python.org/mailman/listinfo/python-dev</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk">http://mail.python.org/mailman/options/python-dev/fuzzyman%40voidspace.org.uk</a>
</pre>
    </blockquote>
    <br>
    <br>
    <pre class="moz-signature" cols="72">-- 
<a class="moz-txt-link-freetext" href="http://www.voidspace.org.uk/">http://www.voidspace.org.uk/</a>

May you do good and not evil
May you find forgiveness for yourself and forgive others
May you share freely, never taking more than you give.
-- the sqlite blessing <a class="moz-txt-link-freetext" href="http://www.sqlite.org/different.html">http://www.sqlite.org/different.html</a>
</pre>
  </body>
</html>