[z3-five] Proposal: use $INSTANCE_HOME/package-includes

Philipp von Weitershausen philipp at weitershausen.de
Wed Jun 23 17:42:23 MEST 2004


Martijn,

> Take the case of a Plone or Silva. For Silva to follow a 
> package-includes strategy we'd need to place the views and adapters in 
> the package-includes direcory, and everything else remains in the Silva 
> directory.

I don't understand that. Everything would remain in the Silva directory. 
The package-includes directory only contains a small

   <include package="Products.Silva" />

snippet.

> The content objects are not going to be moved easily, as 
> that'll break existing ZODBs rather badly. This means that we'll likely 
> end up putting the views and adapters in the Silva product anyway, and 
> the ZCML as well.

The package-includes directory does not contain all of the ZCML for a 
product/package. It contains a small snippet that tells Zope to include 
it. It being there is the on-off switch in Zope3 to include packages. 
The product/package can be anywhere. In Products or not. Doesn't matter.

> Another advantage of the 'Products' way is that people are already 
> familiar with it;

Nothing prevents them from continuing to do so. Using package-includes 
will be an option, not a requirement. I think the proposal explicitly 
stated that.

> So, can we really go the Zope 3 way here the whole hog? It looks to me 
> we'll have to support the Product way for Five as well at the very least.

Right now, support the "Product way" is a simple boiler plate in 
whatever products:

   def initialize(context):
       zcml.process('configure.zcml', package=Products.FiveViewsDemo)

People will still be able to do it. I personally would like to have the 
option for an automation. That's why I wrote the proposal.

>> Zope 3, on the other hand, does not enforce packages to be in a
>> certain place as long as they can be lookuped in PYTHONPATH.  It
>> allows packages that want to be configured to drop in a small ZCML
>> file into a directory called 'package-includes'.  
> 
> 
> Do these get dropped in automatically? How does that mechanism work? Or 
> does an actual sysadmin need to drop these in, instead? From what you 
> say later, the latter; that's an extra burden on the sysadmin.

But it's pretty annoying that everything in Products automagically gets 
picked up. And yes, IIRC, zpkg drops in the file automatically.

>> Five allows us to almost write Zope3-compatible code which works in
>> Zope 2 (using Five).
> 
> As I argued before, the main goal of Five is to allow *existing* 
> products to use Zope 3 code. The main goal is *not* to write Zope 3 
> compatible code in Zope 2. That's only useful if you write new packages.

Your goal is the former, my goal is the latter. The idea of this 
proposal does not involve a conflict of the two interests.

> I highly doubt a developer will actually need to turn off particular 
> features in Five. I think the flexibility to disable parts of Five is a 
> YAGNI.

I beg to differ. I see use cases where people don't need this or that or 
where they want to *customize* parts.


>> I propose to simulate the Zope3 package experience in Five.  There
>> will be a 'package-includes' directory in a Zope 2 instance, just like
>> in a Zope 3 instance.  It will contain a few default include files for
>> the packages that Five itself depends on.  A developer will then be
>> able to install an addon package by dropping a ZCML file in there,
>> just like in Zope3.
> 
> This replaces one action by a sysadmin (install Product) by two
> (install Python package, drop in ZCML). The main audience for 
> installation isn't developers, but sysadmins.

zpkg generates a setup.py that should do this automatically. Anyway, my 
goal is to also support the Z3 way; and if the Z3 way is a bit longer 
(for now), then that's ok with me. Again, you won't have to do it.

> * Supporting the Products way should not be in any way be deprecated and 
> in fact requires our special attention. We need something that is 
> similar to package-includes but actually doesn't require the moving 
> around of zcml snippets into directories by a sysadmin. Perhaps we can 
> make it so that installing a Product is equivalent to the dropping in of 
> ZCML in package-includes, without actually doing so. After all, in Zope 
> 2, people install Products expecting to be able to use them.

Right. That's why I think the convention should be that everything that 
goes into Products doesn't require a package-includes snippet. But I 
would like to be able to use it.

Philipp



More information about the z3-five mailing list