[Python-ideas] problems with import
Guido van Rossum
guido at python.org
Fri Jun 27 23:06:29 CEST 2014
Yeah, so in Python 3.3 this is possible through namespace packages (see PEP
420 -- tldr: remove the empty __init__.py). It has been supported for a
long time in Python 2 by setuptools, and you can even do it yourself by
setting the package's __path__ attribute. See also pkgutil.py in the Python
2 stdlib.
On Fri, Jun 27, 2014 at 2:02 PM, Neal Becker <ndbecker2 at gmail.com> wrote:
> Steven D'Aprano wrote:
>
> > On Fri, Jun 27, 2014 at 02:33:07PM -0400, Antoine Pitrou wrote:
> >> Le 27/06/2014 13:12, Steven D'Aprano a écrit :
> >> >On Fri, Jun 27, 2014 at 09:05:48AM -0400, Neal Becker wrote:
> >> >[...]
> >> >>Now I also have
> >> >>~/.local/lib/python2.7/site-packages/hgext
> >> >>
> >> >>but python won't search there for extensions. Once if finds the
> system
> >> >>hgext
> >> >>directory, it won't look also in the local one.
> >> >
> >> >Re-arrange sys.path so that the local site-packages comes first,
> >> >before the global site-packages. (I'm surprised Python doesn't
> >> >already do this.)
> >>
> >> Then he would have the reverse problem: once he installs a user-local hg
> >> extension, the bundled (official) hg extensions wouldn't be reachable
> >> anymore.
> >
> > Naturally, but I assumed that the only reason you would install
> > something locally was if you intended it to over-ride the global
> > version. If that's not the case, then you're right, it's an issue for
> > Mercurial to solve.
> >
> >
>
> I don't think this is unique to mercurial.
>
> I'd like to have 2 areas for installing extensions to a package:
> a system wide and a local.
>
> I think the semantics we'd want is that the 2 trees are effectively merged,
> with the local overriding in the event of a conflict
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140627/60fcf14b/attachment.html>
More information about the Python-ideas
mailing list