Benjamin Pollack
Benjamin Pollack

Reputation: 28420

Why does my installed app handle pkg_resources.iter_entry_points differently than in source?

I have a Python app that looks for plugins via pkg_resources.iter_entry_points.

When run directly from source checkout, this will find anything in sys.path that fits the bill, including source checkouts that happen to have an applicable .egg-info for setuptools to find.

Yet when I install the package anywhere via python setup.py install, it suddenly ceases to detect everything enumerated in sys.path, instead only finding things that are installed alongside it in site-packages.

Upvotes: 10

Views: 1039

Answers (1)

yacc143
yacc143

Reputation: 385

  1. How to get it to iterate over sys.path?

    pkg_resources.WorkingSet(None).iter_entry_points

  2. Why does it behave differently? Probably because the installed package forces at least the meta data about itself into memory. Looking at the code, my guess would be that your main module has a requires attribute, but that's only an educated guess. Anyway, to force the "installed" behaviour while developing, it should be enough to run python setup.py develop

Upvotes: 2

Related Questions