[Grok-dev] Re: Grok 0.13 released!

Martijn Faassen faassen at startifact.com
Tue Jun 24 07:19:34 EDT 2008


Philipp von Weitershausen wrote:
> Uli Fouquet wrote:
>> I think it would be useful to make the Grok version better visible. This
>> could be done for instance in the admin-UI. The question then is, how
>> the admin UI code should determine the version number. The easiest IMHO
>> would be, if there would be something like a `__version__` attribute for
>> the grok package. So you could do::
>>
>>   >>> import grok
>>   >>> grok.__version__
>>   '0.13'
>>
>> What do you think?
> 
> That's one way, but I think setuptools has some API to determine the 
> installed version of an egg. I think we should try to avoid maintaining 
> a version number in both setup.py and grok/__init__.py.

Hm, yeah, that's a good point, we should use that. Maybe something like 
this:

import pkg_resources

distribution = pkg_resources.get_distribution('grok')
print distribution.version

or something like that should work at least.

> If you're just looking for a quick way to determine the installed 
> version yourself (e.g. for a tutorial), I suggest this:
> 
>   >>> import grok
>   >>> grok
>   <module 'grok' from '.../grok-0.13-py2.4.egg/grok/__init__.pyc'>

It's a bit dangerous if people start relying on this. They might be 
tempted to parse it even... :)

Regards,

Martijn



More information about the Grok-dev mailing list