On Mon, Sep 19, 2016 at 9:25 AM, אלעזר <elazarg@gmail.com> wrote:
Many proposals to add something to stdlib are rejected here with the suggestion to add such library to pypi first. As noted by someone, pypi is not as reachable as stdlib, and one should install that package first, which many people don't know how. Additionally, there is no natural distinction between 3rd party dependencies and in-project imports (at least in tiny projects).

This can be made easier if the first line of the program will declare the required library, and executing it will try to download and install that library if it is not installed yet.

yes, these are issues, but having a module or script download an install something jsut to run is a really bad idea!

I handle it with something like:

try:
    import some_package
except ImportError:
    print("""This package requires  "some_package": if you do not have it installed, it can be installed with pip:
$ python -m pip install my_package
YOu can find more information aobut mypacakge at:
http://github.com/my_package
""")
    raise

Where I've done this has been with ugly optional dependencies -- I don't want to force the user to install the dep simply to run the code, if they are not using features that require it, so I dont put it in teh requiremetns in setup.py (Or conda, or...), But it's nice to get a reasonable message if the user tries to use a feature that does require that dependency.

note also that we don't want to force people to use pip to install packages -- they may use conda, or the system package manager, or want to install from source, or....

-CHB


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov