Over the last couple of days, I've been (shamefully) doing work on "pypes" 
(http://bitbucket.org/chrism/pypes/src/tip/pypes/).  The current state of that 
thing is this:

- it runs repoze.bfg-variant apps  (http://bfg.repoze.org)

- it runs Pylons apps (http://pylonshq.com)

This is a bit of a proof of concept.  I'm still toiling under the (mis-?) 
conception that some bit of consolidation in the Python framework world would 
be 
a good thing, and this is one way to get there.  I'd like to hear what you 
think.

The BFG emulation in pypes is largely complete; it won't actually run BFG 
applications but the applications you create within it are very BFG-like (most 
of the code was cut n pasted from BFG).  It does not rely on the repoze.bfg 
package.  The Pylons emulation is less complete but capable of running most of 
the Pylons "QuickWiki" app with minor changes.  The Pylons emulation actually 
relies on the "pylons" package.

Adding another "flavor" (e.g. "quixoteish" or "zopish") means creating a 
"responder" function ala 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/pylonsish/responder.py . 
It should accept a WebOb style request and return a WebOb style response.  It 
gets wired in via YAML (ala 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/pylonsish/configure.yml).

Adding another "flavor" also usually means creating and registering "directive 
handlers" ala 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/pylonsish/directives.py 
or 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/bfgish/directives.py. 
These are handlers that can be used by end users in YAML config to perform 
application configuration ala 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/pylonsish/quickwiki/quickwiki/configure.yml
 
or 
http://bitbucket.org/chrism/pypes/src/tip/pypes/pypes/bfgish/sampleapp/configure.yml
 
.  Separately flavored systems can run in the same process space by including 
their responders and using their directive handlers.  The diretives help allow 
end-users to override application configuration ala
(conceptually) http://docs.repoze.org/bfg/current/narr/extending.html .

To get a sense of how things hang together operationally, check out the package 
via "hg clone https://[email protected]/chrism/pypes/"; then run:

# cd pypes/pypes
$ virtualenv --no-site-packages env
$ env/bin/python setup.py develop

To run the bfgish app:

$ env/bin/python run.py

(didn't make a paste.ini for this one yet)

To run the pylons-ish app:

$ env/bin/paster serve pypes/pylonsish/quickwiki/quickwiki.ini

Obviously the more interesting bits of this revolve more around what these 
flavors *share* than what makes them different.

Shared is:

- A configuration system (YAML-based)

- Utility functions for path and module manipulation

- A request implementation

- The concept of "overrideable resources" (get pkg_resources to return you a 
package that doesn't actually live at where you've asked for it, ala Zope-style 
skins).

- A "router" (a WSGI app that does dispatching to subsystems).

- A system for capturing startup "options" and the ability to access them
   at runtime (e.g. paste config options).

- Thread local utility stuff provides the ability to get the current request
   and current configuration settings.

This is really the minimum that we could be sharing.  We could share quite a 
bit 
more if we were willing to make concessions and compromises.  But at the very 
minimum, something like pypes lets us share a bit more than library-level 
utilities; namely application configuration system.

FTR, eventually, I'd like to move the packages named "pypes.bfgish" and 
"pypes.pylonsish" to separate distributions (using "pypes" as a namespace 
package) to reduce dependencies.

A note for you Zope-o-phobes, the only reason that "zope.*" libraries are 
installed when this thing gets "setup.py develop"'ed is because the Chameleon 
templating library relies on these.  Nothing in "pypes proper" actually does. 
The top-level dependencies of pypes are:

install_requires=[
     'setuptools',
     'PasteScript',
     'PasteDeploy',
     'Paste',
     'WebOb',
     'Routes',
     'repoze.component',
     'repoze.configuration',
     'Pylons',
     'chameleon.core',
     'chameleon.zpt',
     'martian',
     ]

"chameleon.core", "chameleon.zpt", and "martian" are actually only dependencies 
of the "pypes.bfgish" package; if this was split out, they aren't required. 
Likewise, "Routes" and "Pylons" are actually only dependencies of the 
"pypes.pylonsish" package.

- C

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to