Skip to main content

configurator

Project description

configless is tiny small configurator, inspired by pyramid’s configurator. but this is silly not comprehensive.

how to use

you can develop foo function, so IHasFoo interface. and you are providing two variants of foo function. (my.foo and your.foo are these)

## definition
from zope.interface import Interface, implementer
from configless.interfaces import IPlugin

class IHasFoo(Interface):
    def foo():
        pass

@implementer(IHasFoo, IPlugin)
class MyFoo(object):
    @classmethod
    def create_from_setting(cls, settings):
        return cls()

    def foo(self):
        return "my"

@implementer(IHasFoo)
class YourFoo(object):
    @classmethod
    def create_from_setting(cls, settings):
        return cls()

    def foo(self):
        return "your"


## using
from configless import Configurator
config = Configrator()

## install many plugins about `foo`
config.add_plugin("my.foo", MyFoo, categoryname="foo")
config.add_plugin("your.foo", YourFoo, categoryname="foo")

## activate my.foo plugin, then, my.foo is used by plugin about `foo`.
result = config.activate_plugin("my.foo")

## so, configurator has function about result
config.foo.foo() # => "my"

summary

you can provides ‘foo’ function

  • define plugin

  • install plugin – via config.add_plugin(..)

  • activate plugin – via config.activate_plugin(..)

Project details


Release history Release notifications | RSS feed

This version

0.1

Download files

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

Source Distribution

configless-0.1.tar.gz (4.9 kB view details)

Uploaded Source

File details

Details for the file configless-0.1.tar.gz.

File metadata

  • Download URL: configless-0.1.tar.gz
  • Upload date:
  • Size: 4.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for configless-0.1.tar.gz
Algorithm Hash digest
SHA256 b83924df2cc0b56f424e8ac874007cff85bac44a2d37c3d8305218b967bfecbf
MD5 bce3df5ea51c48f9777ed51ca82bdeaa
BLAKE2b-256 409c035a2aa118a5272ec295d5a49bb146487af262c246848a7ed75178996e08

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