[Biopython-dev] determining the version

Bruce Southey bsouthey at gmail.com
Thu Sep 25 13:28:03 UTC 2008


Peter wrote:
> 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
>
>   
Numpy uses the version.py file to obtain the version and this will also 
include the svn version if an svn version of numpy is being used. The 
advantage is that you can follow the developers changes to find when 
something was fixed or broke. I think the same idea would work for 
Biopython especially once it moves to svn.

For the 1.2.0rc2:
 >>> numpy.__version__
'1.2.0rc2'


Bruce



More information about the Biopython-dev mailing list