This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Blaize Rhodes
Recipients Blaize Rhodes
Date 2016-01-10.10:51:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1452423120.4.0.471254538905.issue26074@psf.upfronthosting.co.za>
In-reply-to
Content
The idea is to add a method to pip that tries to import a package and if the import fails then try to download and install the package handling the UI.

Yes, you can put the package as a dependency in your pip config for 
your code.  This is intended for the case when you have a bunch of 
python tools/libs in some shared repository in your organization.
People check the code out and expect it to run but it has third party 
dependencies.  There is no install step for your code, per se.  Furthermore the people using your code don't know enough about python to install things themselves.

Proposed syntax is:

import pip
pip.require("foo")

If you search online for pip.main you'll see a whole bunch of hall-baked brittle solutions to this problem that look like this:

try:
    import foo
except ImportError:
     pip.main("install", "foo")
History
Date User Action Args
2016-01-10 10:52:00Blaize Rhodessetrecipients: + Blaize Rhodes
2016-01-10 10:52:00Blaize Rhodessetmessageid: <1452423120.4.0.471254538905.issue26074@psf.upfronthosting.co.za>
2016-01-10 10:51:59Blaize Rhodeslinkissue26074 messages
2016-01-10 10:51:59Blaize Rhodescreate