[Grok-dev] Grok and eggs

Uli Fouquet uli at gnufix.de
Sat Feb 21 08:32:34 EST 2009


Hi Derek,

Derek Richardson wrote:
> Kim Luong wrote:
> > 
> > The issue is this. We have an existing paste serve application. We want 
> > to incorporate a dynamic grok app into it. We thought we could do this 
> > by creating a grok app with grokproject and then packaging it as an egg 
> > and using it from the existing paste serve app. But what you've said 
> > means this is not possible.
> > 
> > The only alternative we see is to access the grok app using the paste 
> > proxy code, treating it like it is similar to php instead of capable of 
> > full integration with pre-existing wsgi apps. This is disappointing but 
> > doable. But I think it is important to note that, despite some level of 
> > paster support, the way grok works with grokproject makes it not the 
> > fully mix-and-match experience that we have come to expect from native 
> > wsgi components.
> > 
> > If there is another suitable alternative, please let us know.
> 
> Hey. We just had another thought about this. We can manually pin the egg 
> versions in our setup.py. The part for grok, however, is that it would 
> be nice if grokproject could optionally generate a setup.py with 
> versions pinned appropiately for packaging a project as an egg. That way 
> it's easy for others with needs like ours to do what is necessary to 
> incorporate a new grok project into an existing wsgi app. This seems to 
> go well with the current initiative of moving the paster integration 
> code (startup.py, etc) into an egg and out of grokproject templates.

I just wanted to note, that Michael and me already released the
'external' startup code and you can modify existing 1.0a1 projects to
use it like so:

1) Add 'grokcore.startup' to the list of requirements in your setup.py. 
   If you want to pin the version, use at least '0.2'.

2) Modify the ``entry_points`` of your grokprojects setup.py so that   
   all references to your project's package become references to
   'grokcore.startup'.

   Example for a grokproject named ``sample``:

   Before::

     # setup.py
     ...
     entry_points = """
      [console_scripts]
      sample-debug = sample.startup:interactive_debug_prompt
      sample-ctl = sample.startup:zdaemon_controller
      [paste.app_factory]
      main = sample.startup:application_factory
      """,
      ...

   After::

     # setup.py
     ...
     entry_points = """
      [console_scripts]
      sample-debug = grokcore.startup:interactive_debug_prompt
      sample-ctl = grokcore.startup:zdaemon_controller
      [paste.app_factory]
      main = grokcore.startup:application_factory
      """,
      ...

3) Rerun buildout.

4) You can remove ``startup.py`` from your project code afterwards.

In the long run `grokcore.startup` will become a dependency of `grok`
and also be requested by upcoming releases of `grokproject` but right
now you have to set it up manually as described above.

Micheal and I would be happy (well, sort of) to hear of any problems
with this approach so testers are very welcome.

Best regards,

-- 
Uli

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Dies ist ein digital signierter Nachrichtenteil
Url : http://mail.zope.org/pipermail/grok-dev/attachments/20090221/74835090/attachment.bin 


More information about the Grok-dev mailing list