[Python-ideas] High time for a builtin function to manage packages (simply)?
Terry Reedy
tjreedy at udel.edu
Sun Sep 6 19:54:17 CEST 2015
On 9/6/2015 4:57 AM, Russell Keith-Magee wrote:
> On Sun, Sep 6, 2015 at 12:04 PM, Terry Reedy <tjreedy at udel.edu> wrote:
>> On 9/5/2015 5:03 PM, Terry Reedy wrote:
>>
>>> 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.
>>
>>
>> Inspired by this thread, I did some experiments and am fairly confident that
>> pip.main can be imported and used directly, bypassing paths, subprocesses,
>> and pipes.
>
> I can confirm that this is, indeed, possible. I use this exact
> technique in my tool Briefcase to simplify the process of packaging
> code as an app bundle.
>
> https://github.com/pybee/briefcase/blob/master/briefcase/app.py#L108
There *is*, however, a potential gotcha suggested on the issue by Donald
Stufft and verified by me. pip is designed for one command (main call)
per invocation, not for repeated commands. When started, it finds and
caches a list of installed packages. The install command does not
update the cached list. So 'show new_or_upgraded_package' will not
work. Your series of installs do not run into this.
--
Terry Jan Reedy
More information about the Python-ideas
mailing list