[Python-ideas] High time for a builtin function to manage packages (simply)?

Steven D'Aprano steve at pearwood.info
Mon Sep 7 04:18:02 CEST 2015

On Sat, Sep 05, 2015 at 05:03:36PM -0400, Terry Reedy wrote:
> On 9/5/2015 3:08 AM, Stephen J. Turnbull wrote:
> >So let's fix it, already![1]  Now that we have a blessed package
> >management module, why not have a builtin that handles the simple
> >cases?  Say
> >
> >     def installer(package, command='install'):
> >         ...
> Because new builtins have a high threashold to reach, and this doesn't 
> reach it? Installation is a specialized and rare operation.

You're right about the first part, but as Chris has already suggested, 
this need not be *literally* a built-in. Like help() it could be 
imported at REPL startup.

And I'm not really so sure about how rare it is. Sure, installing a 
single package only happens once... unless you're installing it to 
multiple installations. Or upgrading the package. Or installing more 
than one package. Looking at questions on various programming forums, 
including Python but other languages as well, "how do I install X?" is 
an extremely common question.

And, with the general reluctance to add new packages to the stdlib, and 
the emphasis on putting them onto PyPI first, I think that it will 
become even more common in the future.

> I think a gui frontend is an even better idea. The tracker has a 
> proposal to make such, once written, available from Idle.
>   https://bugs.python.org/issue23551
> I was thinking that the gui code should be in pip itself and not 
> idlelib, so as to be available to any Python shell or IDE. If it covered 
> multiple PMs, then it might go somewhere in the stdlib.

As I see it, there are three high-level steps to an awesome installer:

1. Have an excellent repository of software to install;
2. have a powerful interactive interface to the repo that Just Works;
3. add a GUI interface.

I think that with PyPI we certainly have #1 covered, but I don't think 
we have #2 yet, there are still too many ways that things can "Not 
Work". Number 3 is icing on the cake - it makes a great system even 

I didn't specify whether the interactive interface should be a 
stand-alone application like pip, or an command in the REPL like R uses, 
or even both. I like the idea of being able to install packages directly 
from the Python prompt. It works well within R, and I don't see why it 
wouldn't work in Python either. But it isn't much of an imposition to 
run "python -m pip ..." at the shell.


More information about the Python-ideas mailing list