Re: [Python-Dev] PEP 382: little help for stupid people?
Martin v. Löwis wrote: Ok, so create three tar files: 1. base.tar, containing simplistix/ simplistix/__init__.py So this __init__.py can have code in it? And base.tar can have other modules and subpackages in it? What happens if the base and an addon both define a package called simplistix.somepackage? 2. addon1.tar, containing simplistix/addon1.pth (containing a single *) What does that * mean? I thought .pth files just had python in them? Unpack each of them anywhere on sys.path, in any order. How would this work if base, addon1 and addon2 were eggs managed by buildout or setuptools? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
Ok, so create three tar files: 1. base.tar, containing simplistix/ simplistix/__init__.py So this __init__.py can have code in it? That's the point, yes. And base.tar can have other modules and subpackages in it? Certainly, yes. What happens if the base and an addon both define a package called simplistix.somepackage? Depends on whether simplistix.somepackage is a namespace package (it should). If so, they get merged just as any other namespace package. 2. addon1.tar, containing simplistix/addon1.pth (containing a single *) What does that * mean? See PEP 382 (search for *). I thought .pth files just had python in them? Not at all - they never did. They have paths in them. Unpack each of them anywhere on sys.path, in any order. How would this work if base, addon1 and addon2 were eggs managed by buildout or setuptools? What is a managed egg (i.e. what kind of management does buildout or setuptools apply to it)? Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
Martin v. Löwis wrote: So this __init__.py can have code in it? That's the point, yes. And base.tar can have other modules and subpackages in it? Certainly, yes. Great, when is the PEP due to land in 2.x? ;-) What happens if the base and an addon both define a package called simplistix.somepackage? Depends on whether simplistix.somepackage is a namespace package (it should). If so, they get merged just as any other namespace package. Sorry, I was looking at potential bug cases here. What happens if it's not a namespace package? See PEP 382 (search for *). I thought .pth files just had python in them? Not at all - they never did. They have paths in them. I've certainly seen them with python in, and that's what I hate about them... Unpack each of them anywhere on sys.path, in any order. How would this work if base, addon1 and addon2 were eggs managed by buildout or setuptools? What is a managed egg (i.e. what kind of management does buildout or setuptools apply to it)? Sorry, bad wording on my part... I guess I meant more how would buildout/setuptools go about installing/uninstalling/etc packages thatconform to PEP 382? Would setuptools/buildout need modification or would the changes take effect lower down in the stack? cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
Chris Withers wrote: Martin v. Löwis wrote: So this __init__.py can have code in it? That's the point, yes. And base.tar can have other modules and subpackages in it? Certainly, yes. Great, when is the PEP due to land in 2.x? ;-) Most likely, never - it probably will be implemented only after the last feature release of 2.x was made. What happens if the base and an addon both define a package called simplistix.somepackage? Depends on whether simplistix.somepackage is a namespace package (it should). If so, they get merged just as any other namespace package. Sorry, I was looking at potential bug cases here. What happens if it's not a namespace package? Then it will be imported as a regular child package. Unpack each of them anywhere on sys.path, in any order. How would this work if base, addon1 and addon2 were eggs managed by buildout or setuptools? What is a managed egg (i.e. what kind of management does buildout or setuptools apply to it)? Sorry, bad wording on my part... I guess I meant more how would buildout/setuptools go about installing/uninstalling/etc packages thatconform to PEP 382? Would setuptools/buildout need modification or would the changes take effect lower down in the stack? Unfortunately, I don't know precisely what they do, so I don't know whether any of it needs modification. All I can say is that if they want to install namespace packages using the mechanism of PEP 382, they will have to produce the file layout specified in the PEP. For distutils (which is the only library in that area that I do know), I think just installing any .pth files inside a package would be sufficient. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
2009/5/9 Chris Withers ch...@simplistix.co.uk: Martin v. Löwis wrote: I thought .pth files just had python in them? Not at all - they never did. They have paths in them. I've certainly seen them with python in, and that's what I hate about them... AIUI, there was a small special case that lines starting with import are executed (see the source of site.py for details). This exception has been exploited (some would say abused, but I'm trying to be unbiased here) by setuptools, at least, to do path manipulations and such. PEP 382 does not provide the import exception: Unlike .pth files on the top level, lines starting with import are not supported in per-package .pth files. It's not clear to me what impact this would have on setuptools (probably none, as top-level .pth files aren't changed). Paul. ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
M.-A. Lemburg wrote: The much more common use case is that of wanting to have a base package installation which optional add-ons that live in the same logical package namespace. The PEP provides a way to solve this use case by giving both developers and users a standard at hand which they can follow without having to rely on some non-standard helpers and across Python implementations. My proposal tries to solve this without adding yet another .pth file like mechanism - hopefully in the spirit of the original Python package idea. Okay, I need to issue a plea for a little help. I think I kinda get what this PEP is about now, and as someone who wants to ship a base package with several add-ons that live in the same logical package namespace, I'm very interested. However, despite trying to follow this thread *and* having tried to read the PEP a couple of times, I still don't know how I'd go about doing this. I did give some examples from what I'd be looking to do much earlier. I'll ask again in the vague hope of you or someone else explaining things to me like I'm a 5 year old - something I'm mentally equipped to be well ;-) In either of the proposals on the table, what code would I write and where to have a base package with a set of add-on packages? Simple examples would be greatly appreciated, and might bring things into focus for some of the less mentally able bystanders - like myself! cheers, Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
In either of the proposals on the table, what code would I write and where to have a base package with a set of add-on packages? I don't quite understand the question. Why would you want to write code (except for the code that actually is in the packages)? PEP 382 is completely declarative - no need to write code. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
Martin v. Löwis wrote: In either of the proposals on the table, what code would I write and where to have a base package with a set of add-on packages? I don't quite understand the question. Why would you want to write code (except for the code that actually is in the packages)? PEP 382 is completely declarative - no need to write code. code is anything I need to write to make this work... So, what do I need to do? Chris -- Simplistix - Content Management, Zope Python Consulting - http://www.simplistix.co.uk ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com
Re: [Python-Dev] PEP 382: little help for stupid people?
In either of the proposals on the table, what code would I write and where to have a base package with a set of add-on packages? I don't quite understand the question. Why would you want to write code (except for the code that actually is in the packages)? PEP 382 is completely declarative - no need to write code. code is anything I need to write to make this work... So, what do I need to do? Ok, so create three tar files: 1. base.tar, containing simplistix/ simplistix/__init__.py 2. addon1.tar, containing simplistix/addon1.pth (containing a single *) simplistix/feature1.py 3. addon2.tar, containing simplistix/addon2.pth simplistix/feature2.py Unpack each of them anywhere on sys.path, in any order. Regards, Martin ___ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com