From martin at v.loewis.de Wed Oct 19 22:36:24 2011 From: martin at v.loewis.de (=?ISO-8859-15?Q?=22Martin_v=2E_L=F6wis=22?=) Date: Wed, 19 Oct 2011 22:36:24 +0200 Subject: [Import-SIG] PEP 382 update Message-ID: <4E9F34C8.6040308@v.loewis.de> [TL;DR: namespace packages are now indicated by directories ending in .pyp] I just updated PEP 382, to reflect discussions here on the list and at PyCon DE. As you may recall, it originally proposed to have .pth files in a directory to indicate that it's a namespace package. Then the extension got changed to .pyp, and the file was proposed to merely be a marker file (raising the question what the file name should be). Dinu Gherman has now proposed that just changing the directory name itself should be sufficient, so I changed the PEP accordingly. This also simplifies the impact on PEP 302 importers. With PEP 382, a package P is indicated either by being a directory P with an __init__.py, or by being a directory P.pyp. Each such directory only defines a portion of the package; the parent path (or sys.path) is scanned for all directories having the name P.pyp, and together they form the __path__ attribute of the package. If a P/__init__.py is available, it is executed at package import time; if only P.pyp directories are there, the package starts out empty (except for __name__, __path__, __doc__, etc). In comparison with PEP 402, after my PyCon DE presentation, people discussed that they prefer if Python packages require some kind of explicit declaration - even though Java seems to have done well with packages being just directories with the package name. In particular, a Jython guy observed that they would likely have issues with an approach where a directory P would already be part of a package P, since they often have directories in Jython that have the name of Python packages, but are not meant as such. Since explicit declaration is apparently desired, this would bring us to having a marker file - or just marking the directory itself. Apple has a long tradition of doing so on OS X, and users would right away guess that a .pyp directory is about Python, even if they don't know exactly what it is. This approach also supports one of the original motivations of PEP 382, namely that Linux distributions can opt to install many package portions (such as zope.*) into a single file system location. With this PEP, this would all end up in zope.pyp (e.g. zope.pyp/tal; or even zope.pyp/tal.pyp, since TAL doesn't use the __init__.py feature). Please let me know what you think. Regards, Martin From ncoghlan at gmail.com Thu Oct 20 01:02:57 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 20 Oct 2011 09:02:57 +1000 Subject: [Import-SIG] PEP 382 update In-Reply-To: <4E9F34C8.6040308@v.loewis.de> References: <4E9F34C8.6040308@v.loewis.de> Message-ID: On Thu, Oct 20, 2011 at 6:36 AM, "Martin v. L?wis" wrote: > This approach also supports one of the original motivations of > PEP 382, namely that Linux distributions can opt to install many > package portions (such as zope.*) into a single file system location. > With this PEP, this would all end up in zope.pyp (e.g. > zope.pyp/tal; or even zope.pyp/tal.pyp, since TAL doesn't use > the __init__.py feature). Given that this is an extension of the way we mark modules themselves via extensions (i.e. mod.py, mod.pyc, mod.pyo, mod.pyd) while ignoring other files with the same name, an explicit extension for directories works for me. Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia From barry at python.org Thu Oct 20 04:16:50 2011 From: barry at python.org (Barry Warsaw) Date: Wed, 19 Oct 2011 22:16:50 -0400 Subject: [Import-SIG] PEP 382 update In-Reply-To: <4E9F34C8.6040308@v.loewis.de> References: <4E9F34C8.6040308@v.loewis.de> Message-ID: <20111019221650.2f54058d@resist.wooz.org> Eric, Jason, and I were just talking about getting this feature/pep going again at last night's BACONPIG. Thanks for updating the PEP. I haven't read through the new version yet. On Oct 19, 2011, at 10:36 PM, Martin v. L?wis wrote: >Dinu Gherman has now proposed that just changing the directory name >itself should be sufficient, so I changed the PEP accordingly. This also >simplifies the impact on PEP 302 importers. I vaguely recall that something similar has been discussed on the mailing list before, but that there were problems with directory name markers. I could be misremembering, and will try to find details in my archives. Eric did remark last night that while PEP 402 is broader in scope, and *seems* useful, we really don't know what it will break. Still, we need to get this feature moving again. -Barry From ericsnowcurrently at gmail.com Thu Oct 27 12:30:20 2011 From: ericsnowcurrently at gmail.com (Eric Snow) Date: Thu, 27 Oct 2011 04:30:20 -0600 Subject: [Import-SIG] import engine Message-ID: Hadn't heard anything lately about the import engine. Any news? -eric From ncoghlan at gmail.com Thu Oct 27 13:42:56 2011 From: ncoghlan at gmail.com (Nick Coghlan) Date: Thu, 27 Oct 2011 21:42:56 +1000 Subject: [Import-SIG] import engine In-Reply-To: References: Message-ID: On Thu, Oct 27, 2011 at 8:30 PM, Eric Snow wrote: > Hadn't heard anything lately about the import engine. ?Any news? I believe the ball is currently with me to take Greg's pre-PEP, maybe flesh it out a bit in a few areas and then push it to python-ideas as a proposal for 3.3. It's been a while since I thought about it, though, so I'll spend a bit of time trawling the list archives when I get back to it. No promises on when that will happen though - I've found a few more immediately useful things to be working on in subprocess and shutil (I also still need to push the PEP 380 implementation through to completion and python-ideas is, of course, a wonderful font of impractical ideas to spend my Python time pondering, a number of them emanating from my own brain). With ImportEngine being a fairly long term API cleanup project (we've coped with the current system for a long time - what's a few more years in the grand scheme of things?), it's fairly easy for it to get bumped down the mental "to do" list. It's at least still *on* the list, though :) Cheers, Nick. -- Nick Coghlan?? |?? ncoghlan at gmail.com?? |?? Brisbane, Australia