[Python-ideas] from __pip__ import
אלעזר
elazarg at gmail.com
Mon Sep 19 19:09:53 EDT 2016
Sounds good, thanks.
So I'll suggest adding the method mentioned in Paul's code as a promised
API, either as pip.install or otherwise. `pip.main(['install', 'boltons'])` is
not the clearest it can get.
Elazar
On Tue, Sep 20, 2016 at 2:02 AM David Mertz <mertz at gnosis.cx> wrote:
> >>> import pip
> >>> pip.main(['install', 'boltons'])
> Requirement already satisfied (use --upgrade to upgrade): boltons in
> ./anaconda/lib/python3.5/site-packages
> 0
>
> This is easy, short, and uses existing syntax and an existing module.
> Yes, I know technically the API isn't promised; I wouldn't object to making
> that API official. But PLEASE, no new syntax for doing this!
>
> Btw. On failure:
>
> >>> pip.main(['install', 'nonesuch'])
> Collecting nonesuch
> Could not find a version that satisfies the requirement nonesuch (from
> versions: )
> No matching distribution found for nonesuch
> 1
>
>
> On Mon, Sep 19, 2016 at 3:46 PM, אלעזר <elazarg at gmail.com> wrote:
>
>> On Tue, Sep 20, 2016 at 1:40 AM Paul Moore <p.f.moore at gmail.com> wrote:
>>
>>> On 19 September 2016 at 23:13, אלעזר <elazarg at gmail.com> wrote:
>>> > Alternative syntax might be that of import decorators
>>> >
>>> > @from_pip("attrs")
>>> > import attr
>>>
>>> At which point you may as well just (insert disclaimer about "using
>>> pip's internal API isn't supported" here, and glossing over the fact
>>> that pip doesn't yet have an install function with this API) do
>>>
>>> import pip
>>> pip.install('attrs')
>>> import attr
>>>
>>
>> Please forgive me for my ignorance, but it doesn't work as written -
>> what's the actual method?
>>
>> Elazar
>>
>> _______________________________________________
>> 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/
>>
>
>
>
> --
> Keeping medicines from the bloodstreams of the sick; food
> from the bellies of the hungry; books from the hands of the
> uneducated; technology from the underdeveloped; and putting
> advocates of freedom in prisons. Intellectual property is
> to the 21st century what the slave trade was to the 16th.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160919/95c439e4/attachment.html>
More information about the Python-ideas
mailing list