-
-
Notifications
You must be signed in to change notification settings - Fork 607
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support loading plugins via pkg_resources entry points
This provides an alternative way to find the methods `build_file_aliases` and `register_goals` that are called as part of extension loading, specifically that for off-the-shelf plugins installed as distrubutions, these methods are found using pkg_resources' entry points configuration. Source backends are useful for quick and easy loading of custom tasks or aliases from sources that live in a project. This change is not entended to replace source backends, but rather to make use of richer metadata avilable on packaged distributions used for deploying off-the-shelf plugins. Distributions (egg/sdist/etc) have version information and can define their entry points, which allows cleaner separation of layout and implementation from core pants. Version requirements can be checked at load and plugins can assert other plugins are loaded before them (since order matters eg "replace=True"). Adding such a plugin when using virtualenv pants would consist of adding it to requirements.txt used to setup the virtualenv (or simply pip installing if using global site-packages), then adding it to pants.ini's `plugins` list under the section `backends`. For deployments running pants from a pex, the plugins could either be built into the distributed pex or plugins could still be installed to a virualenv using a requirments.txt if that env were somehow then added to the python path when invoking the pex. This change does not include support for resolving, fetching or in any way installing plugins at runtime -- requested plugins are loaded if they are found or an error is raised if not. If or how how to support loading plugins that are not previously installed is left for a separate discussion. Testing Done: https://travis-ci.org/pantsbuild/pants/builds/43419387 Added tests with mocked out distributions to test_extension_loader.py. Demo repo: https://github.com/foursquare/pants-plugins-demo Bugs closed: 843 Reviewed at https://rbcommons.com/s/twitter/r/1429/
- Loading branch information
Showing
5 changed files
with
209 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters