Skip to main content

A plugin manager based on setuptools entry points mechanism

Project description

A plugin manager based on setuptools entry points with 10x the speed

What for?

To make entry points usable for plugins in time-critical situations (like commandline interfaces)!

Setuptool’s entry point system is convenient to use for plugin based python applications. It allows separate python packaes to act as plugins to a host package, making it easy for the host to find and iterate over the relevant data structures from plugins.

However simply importing setuptools scales badly with the number of installed distributions and can be very slow for moderately complex environments (~ 0.5 s). Finding and loading of plugins on the other hand is time-critical in cases like commandline tools loading subcommands, where 100 ms are a noticeable delay.

Setuptools’s pkg_resources is slow, because it verifies dependencies are installed correctly for all distributions present in the environment on import. This allows entry points to have additional requirements.

Reentry forgoes this dependency check for entry points without such ‘extras’ dependencies and thereby manages to be fast and scale better, with the amount of installed plugins, not installed python packages in general.

CLI Example

Reentry provides a drop-in replacement for iter_entry_points:

import click
from click_plugins import with_plugins
from reentry.manager import iter_entry_points

@with_plugins(iter_entry_points('cli_plugins'))
@click.group()
def cli():
   """
   command with subcommands loaded from plugin entry points
   """

For this to work, reentry has to be installed and must have been used to scan for entry points in the ‘cli_plugins’ group once.

Features

  • finding plugins: reentry keeps a map of entry points in a file

  • speed: reentry provides an EntryPoint implementation that trades extras for search and load speed

  • automatic registering: reentry provides setup() keyword args to register and scan for entry points on install

  • flexible: entry points with extras dependencies still work trying to load them will lead to loading pkg_resources

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

reentry-1.0.tar.gz (6.3 kB view details)

Uploaded Source

Built Distribution

reentry-1.0-py2-none-any.whl (10.1 kB view details)

Uploaded Python 2

File details

Details for the file reentry-1.0.tar.gz.

File metadata

  • Download URL: reentry-1.0.tar.gz
  • Upload date:
  • Size: 6.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for reentry-1.0.tar.gz
Algorithm Hash digest
SHA256 36caf389bfdff776e92d4e0615dbf60c8f72e0c7f338c86fb14c54923a6639f9
MD5 06128f54fbee90a30490ea782e04bc24
BLAKE2b-256 c06ea3611e4cb41e5981642c9927f578bed76b8ca48059d06cc89389ce3f0088

See more details on using hashes here.

File details

Details for the file reentry-1.0-py2-none-any.whl.

File metadata

File hashes

Hashes for reentry-1.0-py2-none-any.whl
Algorithm Hash digest
SHA256 00fbcb26ab9edfd01aa36041a00b8c8e3e5da20452a19f1ab4cba8d7c9efde69
MD5 543ec30e6fe211d0a92ccd514fc04b1a
BLAKE2b-256 ce14574a30abd8409fb8827687d85607b169a1a525a7afa1ff6bc336127c0b08

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page