Re: Using file system links to unbundle python packages

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jun 09, 2014 at 01:43:53PM +0200, Sergio Pascual wrote:
> So, do you mean changing things like:
> 
> from ...extern.six.moves.http_client import HTTPSConnection
> 
> to
> 
> try:
>     from six.moves.http_client import HTTPSConnection
> except ImportError:
>     from ...extern.six.moves.http_client import HTTPSConnection
> 
> everywhere in the code? Surely upstream is not going to to accept it.
> 
Some upstreams do accept this.

> What they could accept is a mechanism in  extern.six to load the system package
> when is available and the bundled package when it is not. The same for the
> other packages (ply, pytest, etc). But that's what I'm trying to avoid by
> linking.
> 

This can be done as well.  Take a look at how kitchen.pycompat* is coded for
instance:

http://bzr.fedorahosted.org/bzr/kitchen/devel/annotate/head:/kitchen/pycompat24/base64/__init__.py

Note that import * isn't guaranteed to get all of the publically available
API because __all__ might not be complete in a given module.  If you run
into that you have to do something like:

try:
    from module import *
    from module import not_in__all__
except ImportError:
    from _module import *
    from _module import not_in__all__

>  
> 
>     Of course, a primary question is why are these modules bundled?
>     Is it only out of convenience (for the users/developers)?
>     Are there strict dependencies on specific versions of these modules?
> 
> 
> It's a matter of convenience. The only hard requirement of astropy is numpy.
> 
Why are these modules considered part of the astropy API?  That seems like
bad practice.  It may be that the packages which use astropy.extern.* should
also be taught to use

try: from system module except ImportError: from bundled location

-Toshio

Attachment: pgpKKM6oTLZtW.pgp
Description: PGP signature

--
packaging mailing list
packaging@xxxxxxxxxxxxxxxxxxxxxxx
https://admin.fedoraproject.org/mailman/listinfo/packaging

[Index of Archives]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite Forum]     [KDE Users]

  Powered by Linux