egg issues: adding namespace boilerplate Products / patching testrunner
2 items: 1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs? try: __import__('pkg_resources').declare_namespace(__name__) except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__) 2. Could we consider this a defect so it could be added to relavent maintenance branches(provided no one sees any harm in #1. I mainly care about zope 2.9) 3. daniel nouri has made a patch for the test runner to enable a flag optionally add all packages on your path to the test search path. I consider this a defect in the current test runner that makes working with eggs and 2.9 or 2.10 rather cumbersome. could we consider adding this or some other solution to this problem? http://www.zope.org/Collectors/Zope/2276 -w -- ------ d. whit morriss ------ - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995
whit wrote at 2007-4-13 10:43 -0500:
2 items:
1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs?
try: __import__('pkg_resources').declare_namespace(__name__)
except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
If you add this monster, please add also a manifest comment which indicates what it is for. If possible, add it at the end of module: My XEmacs version loses the ability to recognize function and class definitions after the first top level "try: ... except ...:". -- Dieter
Dieter Maurer wrote:
If possible, add it at the end of module:
My XEmacs version loses the ability to recognize function and class definitions after the first top level "try: ... except ...:".
Maybe you should fix your editor then? ;-) Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
whit wrote:
2 items:
1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs?
try: __import__('pkg_resources').declare_namespace(__name__)
except ImportError: from pkgutil import extend_path __path__ = extend_path(__path__, __name__)
+1
2. Could we consider this a defect so it could be added to relavent maintenance branches(provided no one sees any harm in #1. I mainly care about zope 2.9)
Would it really be necessary? Products as eggs already work, as long as Zope-2.x/lib/python/Products has been imported first. In a normal Zope 2 environment, this is typically the case.
3. daniel nouri has made a patch for the test runner to enable a flag optionally add all packages on your path to the test search path. I consider this a defect in the current test runner that makes working with eggs and 2.9 or 2.10 rather cumbersome. could we consider adding this or some other solution to this problem?
Why is this a defect? -- http://worldcookery.com -- Professional Zope documentation and training
Previously whit wrote:
2 items:
1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs?
Aren't we asking people to move to using python packages instead? I'm -1 on requiring such changes to Products. Wichert. -- Wichert Akkerman <wichert@wiggy.net> It is simple to make things. http://www.wiggy.net/ It is hard to make things simple.
Wichert Akkerman wrote:
Previously whit wrote:
2 items:
1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs?
Aren't we asking people to move to using python packages instead?
Well, I certainly hope we're not asking people to rename all of their existing products because that would be a waste of time. This change eases the deployment of existing products as eggs.
I'm -1 on requiring such changes to Products.
I think you're misunderstanding the issue at hand. Nobody's products will have to change. Zope's lib/python/Products/__init__.py will change. -- http://worldcookery.com -- Professional Zope documentation and training
Philipp von Weitershausen wrote:
Wichert Akkerman wrote:
Previously whit wrote:
2 items:
1. how does everyone feel about adding the following boilerplate to all occurences of Products/__init__.py to enable the easy creation of Product eggs?
Aren't we asking people to move to using python packages instead?
Well, I certainly hope we're not asking people to rename all of their existing products because that would be a waste of time.
This change eases the deployment of existing products as eggs.
I'm -1 on requiring such changes to Products.
I think you're misunderstanding the issue at hand. Nobody's products will have to change. Zope's lib/python/Products/__init__.py will change.
exactly... and python packages don't quite work right all the time(like that wierd bug with directory views and ZEO). -w -- ------ d. whit morriss ------ - senior engineer, opencore - - http://www.openplans.org - - m: 415-710-8975 - "If you don't know where you are, you don't know anything at all" Dr. Edgar Spencer, Ph.D., 1995
participants (5)
-
Chris Withers -
Dieter Maurer -
Philipp von Weitershausen -
whit -
Wichert Akkerman