[Python-ideas] install pip packages from Python prompt

Nathaniel Smith njs at pobox.com
Thu Nov 2 04:46:23 EDT 2017


On Wed, Nov 1, 2017 at 2:47 PM, Terry Reedy <tjreedy at udel.edu> wrote:
> When pip installs a package into site_packages, does it at any point run
> package-specific installation code?  setup.py?

Nope. That's a can of worms that we've so far avoided opening.

> More specifically, can pip
> install an IDLE extension. If so, I think installing pipgui should add
> 'x_pipgui.py' to idlelib, if it exists, and add a section to
> idlelib/config-extension.def.  Using the existing extension mechanism would
> be an alternative to patching IDLE to conditionally add pipgui to some menu.

There is a de facto standard way to do this, which is to advertise a
setuptools entrypoint:
    https://setuptools.readthedocs.io/en/latest/setuptools.html#dynamic-discovery-of-services-and-plugins
This is some static metadata that a plugin can include in their
package in a well known place, and that tools like pkg_resources can
then look up.

But unfortuately this hasn't been standardized, and there's currently
no way to do the lookup from the stdlib, so maybe this is not so
helpful for IDLE...

-n

-- 
Nathaniel J. Smith -- https://vorpus.org


More information about the Python-ideas mailing list