[Biopython-dev] determining the version

Peter biopython at maubp.freeserve.co.uk
Thu Sep 25 09:22:56 UTC 2008


On Thu, Sep 25, 2008 at 9:47 AM, Michiel de Hoon <mjldehoon at yahoo.com> wrote:
>
>> Perhaps we should add a __version__ to Bio/__init__.py for
>> future releases, with the release "script" modified to
>> ensure this gets incremented to match that used in
>> setup.py (and Martel).
>
> Another solution is that setup.py uses (reads or imports)
> __init__.py to find out what the version is. For example,
> this is what matplotlib does in its setup.py script.
>

That sounds more sensible - I had been wondering about
how that could be automated but it was late last night.
>From a quick look at approach taken in the matplotlib
code, we could add something like this to setup.py

__version__ = "Undefined"
for line in open('Bio/__init__.py'):
     if (line.startswith('__version__')):
         exec(line.strip())

setup(
    name='biopython',
    version=__version__,
    author='The Biopython Consortium',
    ...

I'm happy to deal with this if we are agreed that we
should add a __version__ to Bio/__init__.py
(variations on the naming are possible, but this seems
to be a de-facto standard in python libraries).

Peter



More information about the Biopython-dev mailing list