Skip to main content

lightweight python plugin system supporting config inheritance

Project description

pluginmgr

PyPI PyPI Tests Codecov Language grade: Python

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.2.1.tar.gz (73.7 kB view details)

Uploaded Source

Built Distribution

pluginmgr-1.2.1-py3-none-any.whl (9.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pluginmgr-1.2.1.tar.gz
  • Upload date:
  • Size: 73.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for pluginmgr-1.2.1.tar.gz
Algorithm Hash digest
SHA256 eb4f78521861224e79ce045e6f97ffa06a347b955e6e69e44716acda4ca024d4
MD5 3b627655e24bde4041a1fc88e7e001be
BLAKE2b-256 f3f479b24459b62bcf4fb802fdc74da36703165ce1a5979395f5d22b9f0f5c45

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pluginmgr-1.2.1-py3-none-any.whl
  • Upload date:
  • Size: 9.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.7

File hashes

Hashes for pluginmgr-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ee9ca530ad1a369c43cb4486fa6815d2fc99f9bc598d42414f96a98b36fc80c2
MD5 0d88a79058e09873decc6be0ed471794
BLAKE2b-256 19905423e558b63ac6002396ab6b3b03ee8d548c55731dad4e86608b4bc22507

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