[Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-23 Thread Martijn Faassen

Jim Fulton wrote:


On Apr 23, 2007, at 2:43 PM, Martijn Faassen wrote:
...
It'd be a lot easier. You'd still have to list it for all eggs that 
you depend on directly. It would be nice if this could be automated as 
well, as being in two places to add a single dependency is more work 
than being in one place. Could be done with a special recipe, I think.


Except that the information belongs in your application package's 
configure.zcml.  site.zcml should, IMO, be a very short file that
include's your application package's configure.zcml.  If you want to 
write a tool that writes your configure.zcml, go for it.


I wouldn't object to a zcml configuration directive that took a project 
name and included zcml files provided by it's dependencies at run time.


Yes, that would be useful. I will think about it. Preferably it should 
be somewhat ZCML independent so Grok can make use of it too.


Package-level ZCML include dependencies would also mean a kind of 
duplication, too. You list dependencies in setup.py and then again in 
the package's ZCML.


You could argue that the dependencies in setup.py duplicate information 
in your Python import statements -- if you wanted to.


Good point, but I don't want to argue that. :) Anyway, automating egg 
dependencies from import statements is somewhat harder as some 
information is missing (egg name, version requirements). An interesting 
project. :) Not urgent, though.


I realize I'm quite active in looking for points of duplication to 
reduce. I don't think it's a bad exercise for any framework to do this.


[snip]
I can see how -o is the most deterministic buildout behavior, as it 
will upgrade nothing. The next step in my mind would be -N, as it only 
installs what's not there yet. Finally there's no option, which is 
least predictable it might start updating stuff, depending on what 
package restrictions you have. Obviously I'm not understanding what 
you mean by deterministic.


The default behavior is to update all packages to the most recent 
version that satisfies your requirements.  This means that running 
buildout in 2 different buildouts with the same configuration should 
produce the same results, regardless of their history.  I think this is 
an important property that you lose with -N.


Ah, understood. I hadn't thought of this in the context of multiple 
buildouts, but that's of course an important property for team 
development situations.


 It is easy for people to change the default for their own use by 
putting:

   [buildout]
   newest = false
in their ~/.buildout/default.cfg file.


Ah, a trick I wasn't aware of. I will do that then in my 
buildout.cfgs, though this will indeed might cause a few surprises to 
people they might get used to it and be surprised when they need -N in 
other buildouts.


That's why I suggested putting it in: ~/.buildout/default.cfg, which 
would effect only you.


Ah, I should read more carefully, sorry. I should also look up the 
explicit option to turn on newest again to make sure I can develop as 
part of a team. :)


Regards,

Martijn


___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-22 Thread David Pratt
Hi Tres and Martijn. I apologize for the length of this post in advance. 
I have been spending a bit of time on app buildouts over the past days. 
What I have learned about some of this is that there are a couple of 
ways to configure apps with pluses and minuses.


There are also major differences in time running buildouts depending on 
how you construct an app (since buildout checks against eggs in the main 
setup, dev eggs etc). To get a good sense of the acrobatics it is good 
to increase the verbosity of the output generated in buildout to -vv 
(you can add more v's to see more).


In looking at the way I am developing, my goals are package reuse and 
thin glue in an app package (that is also the app egg) to bind packages 
to make an application consisting mostly of installation, security, 
testing and perhaps skinning. That said, I do not really want or care 
about organizing packages neatly under a single src folder to pull them 
together into a larger egg. To keep it simple, I just want to list the 
eggs I use in app part of my buildout. In the end it all about making 
sure that the code is able to connect.


You are penalized for this approach in app buildouts since more small 
independent eggs (holding some generic functionality) with their own 
dependencies equals more checks. Being explicit like this increases the 
amount of time for the buildout to run, particularly if there are plenty 
of eggs with many dependencies. Think in numbers like 150 - 200+ eggs 
with zope and zope app - no exaggeration. Ok - now think again - that 
could be your time and not machine time working out that all 
dependencies are met. You start saying I like what computers can do and 
I can be patient while the checks are made.


An approach that that leads to shorter app buildouts is to group 
packages under the main app setup.py. This is currently what fits with 
the development approach spelled out in the app recipe docs but it has 
downsides also. This is nice for speed in running a buildout but don't 
like the fact that the main setup has got to capture dependencies for 
the collection as a whole because you just a bigger egg with multiple 
packages where you still need to track down dependencies. True, some of 
these may be packages from external eggs you need to list, but probably 
more are packages that you have assembled within your app (that may be 
desirable to re-use) but where you have not been being explicit about 
the dependencies (since these are determined in an egg not a package).


Personally, I don't want to take the time to try to pull the 
dependencies together in an app that is a collection of packages like 
this - since it is a chore not worthy of a human. A machine can do this 
better than I can (and it is welcome to the task!). Also, apps are prone 
to change - each change equals more time re-examining this over this 
again and again amidst a constantly changing landscape of package 
revisions - yuk. When you add that as a zope3/python developer you are 
mostly working at a package level, you realize that spelling 
dependencies with more granularity in an egg is much more attractive and 
just easier overall than figuring this out for an app with a cluster of 
packages afterwards (on top of how this all goes together with other 
external/namespace packages like zope, zope.app, z3c, zc etc, etc).


I feel the same way about the site.zcml. In the initial docs on the app 
recipe, a smaller site.zcml is recommended since you can tuck most of 
the meat in your app configuration. In experimenting, the bottom line is 
it doesn't really matter where it is - because is really the same size 
regardless of where the pieces reside.  So I have been considering - 
what am I really trying to do here - and how much grief do I want to 
encumber putting it all together. The semantics of having a large 
site.zcml that takes care of app configuration is not inconsistent with 
the fact that I am using the buildout to configure and build my app. So 
in the end I would be happy to consider a larger site.zcml that does the 
work of organizing includes to all packages in the app. And at the 
package level being left with just making the includes within it (such 
as including a browser or an ftest sub package) to complete the 
configuration tree.


That said, I don't relish to time it will take to looking at ordering 
all of the includes in a site.zcml. It is tedious work and not fun at 
all. Here, this is still about dependency first. We need to make sure 
that as configuration is read, the app already knows enough for the next 
bit of configuration so it does not choke when run. Put it in the wrong 
order and your app will not understand what an adapter is, or a provider 
or one of your custom components. Unlike the comfort we had in 
automatically having all of the zope or zope app packages when we use 
zope we are now in the drivers seat to determine what we need by 
spelling it out. This provides power and 

[Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-22 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Jim Fulton wrote:
 On Apr 22, 2007, at 10:32 AM, David Pratt wrote:
 ...
 In looking at the way I am developing, my goals are package reuse  
 and thin glue in an app package (that is also the app egg) to bind  
 packages to make an application consisting mostly of installation,  
 security, testing and perhaps skinning. That said, I do not really  
 want or care about organizing packages neatly under a single src  
 folder to pull them together into a larger egg. To keep it simple,  
 I just want to list the eggs I use in app part of my buildout.
 
 I wonder what you are trying to contrast here.  Your goal of being  
 able to just list eggs sounds reasonable.  Who would disagree with it?
 
 ...
 
 You are penalized for this approach in app buildouts since more  
 small independent eggs (holding some generic functionality) with  
 their own dependencies equals more checks.
 
 What checks are you referring to?
 
 Being explicit like this
 
 Like what?  I don't understand what the this is that you are  
 referring to.
 
 increases the amount of time for the buildout to run, particularly  
 if there are plenty of eggs with many dependencies. Think in  
 numbers like 150 - 200+ eggs with zope and zope app - no exaggeration.
 
 Are you referring to Buildout's checking for new egg versions?
 Judicious use of the -N option can cut down on this a lot.
 
 ...
 
 An approach that that leads to shorter app buildouts is to group  
 packages under the main app setup.py. This is currently what fits  
 with the development approach spelled out in the app recipe docs  
 but it has downsides also.
 
 I don't understand what you are referring to. Which app recipe are  
 you referring to?
 
 This is nice for speed in running a buildout but don't like the  
 fact that the main setup has got to capture dependencies for the  
 collection as a whole because you just a bigger egg with multiple  
 packages where you still need to track down dependencies. True,  
 some of these may be packages from external eggs you need to list,  
 but probably more are packages that you have assembled within your  
 app (that may be desirable to re-use) but where you have not been  
 being explicit about the dependencies (since these are determined  
 in an egg not a package).
 
 Could you give some examples of what you're talking about.  I'm  
 trying to follow you but can't.  You seem to be discussing whether  
 dependencies should be listed in a setup file and suggesting that it  
 somehow affects buildout performance.  buildout performance isn't  
 affected by *where* dependencies are defined.  If your package has  
 dependencies, then list them.  This is othogonal to performance.
 
 Personally, I don't want to take the time to try to pull the  
 dependencies together in an app that is a collection of packages  
 like this - since it is a chore not worthy of a human.A machine can  
 do this better than I can (and it is welcome to the task!). Also,  
 apps are prone to change - each change equals more time re- 
 examining this over this again and again amidst a constantly  
 changing landscape of package revisions - yuk.
 
 Are you referring to Python dependencies or ZCML dependencies?
 
 If you are the author of a package, you should know what other  
 packages you're using.  You should know when this changes.  In  
 theory, determining these dependencies could be automated.  No one  
 has automated it yet.
 
 
 When you add that as a zope3/python developer you are mostly  
 working at a package level, you realize that spelling dependencies  
 with more granularity in an egg is much more attractive and just  
 easier overall than figuring this out for an app with a cluster of  
 packages afterwards (on top of how this all goes together with  
 other external/namespace packages like zope, zope.app, z3c, zc etc,  
 etc).
 
 I wish I knew what you were trying to say here.
 
 Are you saying that if A depends on B and B depends on C and A  
 doesn't use C directly that A should not have to list C as a  
 dependency?  If so, I don't think anyone would disagree with you.
 
 I feel the same way about the site.zcml. In the initial docs on the  
 app recipe,
 
 What app recipe. Please be specific.
 
 a smaller site.zcml is recommended since you can tuck most of the  
 meat in your app configuration. In experimenting, the bottom line  
 is it doesn't really matter where it is - because is really the  
 same size regardless of where the pieces reside.  So I have been  
 considering - what am I really trying to do here - and how much  
 grief do I want to encumber putting it all together. The semantics  
 of having a large site.zcml that takes care of app configuration is  
 not inconsistent with the fact that I am using the buildout to  
 configure and build my app. So in the end I would be happy to  
 consider a larger site.zcml that does the work of organizing  
 includes to all packages in the app. And 

[Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-22 Thread Jim Fulton


On Apr 22, 2007, at 12:00 PM, Tres Seaver wrote:



I don't think this is necessary.  An egg that has ZCML should load
the ZCML from other eggs it depends on.  This means that these eggs
have to be designed this way.


Our override story is too weak to support this now, because the author
of package C may make a configuration choice which is inappropriate
for how C is used in B or A:  we have no way to turn off such
choices (we can shadow them, but not disable them).  We really need a
way to spell include the configuration from package 'A' except for  
the

view registrations or include only the utilitiy registration for the
'IFoo' utiltiy from package 'B', or else we need to make the
configurations much more fine-grained.

Otherwise, we end up in a situation where using a package means
accepting all of its configuration blindly;  at that point, there  
is no

win to moving the registrations out of Python code in the first place.


You argument is correct, however, in practice, it usually doesn't  
matter.


I would like to see a way to disable things in ZCML.  There are a  
couple of proposals for doing this.  I'd like to see one of them  
(preferably mind :) get implemented.


Jim

--
Jim Fulton  mailto:[EMAIL PROTECTED]Python 
Powered!
CTO (540) 361-1714  
http://www.python.org
Zope Corporationhttp://www.zope.com http://www.zope.org



___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com



Re: [Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-22 Thread Jim Fulton


On Apr 22, 2007, at 10:32 AM, David Pratt wrote:
...
In looking at the way I am developing, my goals are package reuse  
and thin glue in an app package (that is also the app egg) to bind  
packages to make an application consisting mostly of installation,  
security, testing and perhaps skinning. That said, I do not really  
want or care about organizing packages neatly under a single src  
folder to pull them together into a larger egg. To keep it simple,  
I just want to list the eggs I use in app part of my buildout.


I wonder what you are trying to contrast here.  Your goal of being  
able to just list eggs sounds reasonable.  Who would disagree with it?


...

You are penalized for this approach in app buildouts since more  
small independent eggs (holding some generic functionality) with  
their own dependencies equals more checks.


What checks are you referring to?


Being explicit like this


Like what?  I don't understand what the this is that you are  
referring to.


increases the amount of time for the buildout to run, particularly  
if there are plenty of eggs with many dependencies. Think in  
numbers like 150 - 200+ eggs with zope and zope app - no exaggeration.


Are you referring to Buildout's checking for new egg versions?
Judicious use of the -N option can cut down on this a lot.

...

An approach that that leads to shorter app buildouts is to group  
packages under the main app setup.py. This is currently what fits  
with the development approach spelled out in the app recipe docs  
but it has downsides also.


I don't understand what you are referring to. Which app recipe are  
you referring to?


This is nice for speed in running a buildout but don't like the  
fact that the main setup has got to capture dependencies for the  
collection as a whole because you just a bigger egg with multiple  
packages where you still need to track down dependencies. True,  
some of these may be packages from external eggs you need to list,  
but probably more are packages that you have assembled within your  
app (that may be desirable to re-use) but where you have not been  
being explicit about the dependencies (since these are determined  
in an egg not a package).


Could you give some examples of what you're talking about.  I'm  
trying to follow you but can't.  You seem to be discussing whether  
dependencies should be listed in a setup file and suggesting that it  
somehow affects buildout performance.  buildout performance isn't  
affected by *where* dependencies are defined.  If your package has  
dependencies, then list them.  This is othogonal to performance.


Personally, I don't want to take the time to try to pull the  
dependencies together in an app that is a collection of packages  
like this - since it is a chore not worthy of a human.A machine can  
do this better than I can (and it is welcome to the task!). Also,  
apps are prone to change - each change equals more time re- 
examining this over this again and again amidst a constantly  
changing landscape of package revisions - yuk.


Are you referring to Python dependencies or ZCML dependencies?

If you are the author of a package, you should know what other  
packages you're using.  You should know when this changes.  In  
theory, determining these dependencies could be automated.  No one  
has automated it yet.



When you add that as a zope3/python developer you are mostly  
working at a package level, you realize that spelling dependencies  
with more granularity in an egg is much more attractive and just  
easier overall than figuring this out for an app with a cluster of  
packages afterwards (on top of how this all goes together with  
other external/namespace packages like zope, zope.app, z3c, zc etc,  
etc).


I wish I knew what you were trying to say here.

Are you saying that if A depends on B and B depends on C and A  
doesn't use C directly that A should not have to list C as a  
dependency?  If so, I don't think anyone would disagree with you.


I feel the same way about the site.zcml. In the initial docs on the  
app recipe,


What app recipe. Please be specific.

a smaller site.zcml is recommended since you can tuck most of the  
meat in your app configuration. In experimenting, the bottom line  
is it doesn't really matter where it is - because is really the  
same size regardless of where the pieces reside.  So I have been  
considering - what am I really trying to do here - and how much  
grief do I want to encumber putting it all together. The semantics  
of having a large site.zcml that takes care of app configuration is  
not inconsistent with the fact that I am using the buildout to  
configure and build my app. So in the end I would be happy to  
consider a larger site.zcml that does the work of organizing  
includes to all packages in the app. And at the package level being  
left with just making the includes within it (such as including a  
browser or an ftest sub package) to complete the 

[Zope3-dev] Re: Autoconfiguring a site.zcml

2007-04-22 Thread Tres Seaver
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Martijn Faassen wrote:
 Hello,
 
 Tres Seaver wrote:
 David Pratt wrote:
 On the basis that eggs spell out dependencies, I am thinking the 
 inclusion of packages and their dependencies should be enough to dictate 
 the sequence of inclusion for package configuration (and creation of the 
 site.zcml) for the app buidout recipe. This could be a option to the 
 current manual configuration.
 - -1.  Configuration is *policy*;  implicitly wiring in the default
 configuration for every egg on the path is not going to be an acceptable
 default.
 
 In the path? David didn't say in the path, did we? What about in the 
 buildout? Since my buildout already says explicitly it wants egg foo, 
 and egg foo needs egg bar, it is a major pain to have to specify the 
 ZCML for bar manually.
 
 I don't think something being policy means it's automatically a bad 
 candidate for automation. Information about the policy may after all be 
 elsewhere in the system, for instance in a buildout.cfg.

You don't see cases already where you want to use something from
somebody else's package / egg, but don't want to accept every
configuration choice they make?  This is pretty hard to do if the system
automagically wires in every pacakge's 'configure.zcml'.  One of the big
knocks against Zope2's 'product story was exactly this:  there was no
way to use a product without accepting its entire configuration.

 Presumably, the reason folks would use this recipe is to configure one 
 or more of the same app. I know attempting to do this manually is prone 
 to errors if packages are not in the correct sequence or if you miss the 
 configuration of a package. Any thoughts on this. Many thanks.
 Not necessarily.  There are really two kinds of packages in play here:
 libraryish packages, which supply mechanisms, and applicationish
 packages, which use the mechanism according to some policy.  I would
 argue that the only things you can safely auto-include would be the
 'meta.zcml', because it is policy-free.  Reusable packages need to avoid
 imposing policy (they may *suggest* it, but they shouldn't insist).
 
 That's where we have the concept of overridable defaults. So the default 
 should be to follow the suggestions, and there should be an option in 
 the system to override this suggestion.

There is not such place right now.  The 'includeOverrides' directive is
not expressive enough.

 I would cheer if somebody proposed writing a UI which introspcts
 packgaes for such suggestions, and allows the site manager to merge /
 override them to create an appropriate 'site.zcml'.  Until then, I don't
 want package authors dictating to site managers.
 
 Who are these ZCML-using site managers you are speaking of? Anyway, are 
 you saying you want some form of ZCML UI to be created before *any* 
 automation can be implemented? Asking for the creation of a UI on the 
 Zope 3 mailing list is paramount to waiting forever...

*I* am the user I'm talking about:  I want to be able to use others'
components without swallowing whole their configuration choices;  today,
that means copying and modifying their 'configure.zcml' files.

 If you never automate policy, you'll be writing a lot of stuff by hand. 
 That may be fine for you, but I myself would prefer to write less boring 
 code and focus on more interesting problems.

Automation which is hard to understand and override is the source of the
Z shaped learning curve which plagued Zope2;  it also plagues other
convenience-oriented frameworks outside of Zopeland.


Tres.
- --
===
Tres Seaver  +1 540-429-0999  [EMAIL PROTECTED]
Palladion Software   Excellence by Designhttp://palladion.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFGK4lm+gerLs4ltQ4RApoUAJ4g8t3xOSqAsIAcIawKy0xwgYrBqACeKoxJ
2Bq3bKeJZkT+sf/bxx5UUMQ=
=TbFf
-END PGP SIGNATURE-
___
Zope3-dev mailing list
Zope3-dev@zope.org
Unsub: http://mail.zope.org/mailman/options/zope3-dev/archive%40mail-archive.com