Skip to main content

lightweight python plugin system supporting config inheritance

Project description

pluginmgr

PyPI PyPI Tests Codecov

lightweight python plugin system supporting config inheritance

To use

There is a full example at https://github.com/20c/pluginmgr/tree/master/tests/pluginmgr_test

Create the manager, for example in a module __init__.py file

import pluginmgr

# this is the namespace string that import uses
namespace = 'pluginmgr_test.plugins'

# directories to look in, string or list of strings
searchpath = 'path/to/search/in'

# determines if this should create a blank loader to import through. This
# should be enabled if there isn't a real module path for the namespace and
# disabled for sharing the namespace with static modules
# default is False
create_loader = False

plugin = pluginmgr.PluginManager(namespace, searchpath, create_loader)

Create and register a plugin, note the filename needs to be the same as registered name

from pluginmgr_test import plugin


# register a plugin named mod0
@plugin.register('mod0')
class Mod0(pluginmgr.PluginBase):
    pass

See the dict containing all registered plugins

from pluginmgr_test import plugin

# dict of all registered plugins
print(plugin.registry)

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

pluginmgr-1.0.1.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

pluginmgr-1.0.1-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file pluginmgr-1.0.1.tar.gz.

File metadata

  • Download URL: pluginmgr-1.0.1.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for pluginmgr-1.0.1.tar.gz
Algorithm Hash digest
SHA256 151c8afe8df535f2e02255433cd3340000b3428018692f0581ff53d6f74c3630
MD5 0b5943ab9c3d03c1a87972ae63f99e02
BLAKE2b-256 ab9288ea403e0b000b3bac12cb3eca0b0b728ae79a39a0e2b06911df0472d91e

See more details on using hashes here.

File details

Details for the file pluginmgr-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: pluginmgr-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 9.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.6

File hashes

Hashes for pluginmgr-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1f24786c2cac55e17f3496bd915b8c336792ecc9edb2b61ea5f73ce3a8a1eec9
MD5 0124b6ed397a5e4dce08367b757f5fe7
BLAKE2b-256 5cddf59a021c5a250d133887e2ea3e3ca34863537cab21bbcd7a08ab2160b387

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