[Grok-dev] Re: Grok 0.13 released!
Uli Fouquet
uli at gnufix.de
Tue Jun 24 07:41:17 EDT 2008
Martijn Faassen wrote:
> Philipp von Weitershausen wrote:
> > Uli Fouquet wrote:
> >>
> >> >>> 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.
Nice! That's what I was looking for :-)
So what about grok.version() providing this?
>>> import grok
>>> grok.version()
'0.13dev'
Well, I could live without it and it is only a two-liner. But to give
starters with Grok a better access to the version...
> > 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... :)
Yup. Not too reliable, for instance when you do a subversion checkout,
but it was also the only way I knew about until now.
Kind regards,
--
Uli
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 191 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20080624/b7fa56e8/attachment.bin
More information about the Grok-dev
mailing list