New submission from Blaize Rhodes: 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") ---------- files: require.py messages: 257903 nosy: Blaize Rhodes priority: normal severity: normal status: open title: Add a method to pip.. pip.require("package_name") type: enhancement Added file: http://bugs.python.org/file41565/require.py _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26074> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com