Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Extensible

Small library for registry and instantiation of extensions.

Example

    from extensible import Extensible, Option, OptionType

    class Printer(Extensible, is_base=True):
        extension_type = "printer"
        pass
    
    class PrettyPrinter(Printer):
        extension_name = "pretty"
        extension_options = [
            Option("indent", OptionType.int, default=4)        
        ]

        indent: int

        def __init__(self, indent: int) -> None:
            self.indent = indent

Instantiation:

    printer: Printer
    printer = Printer.concrete_extension("pretty") \
                .create_with_dict({"indent": "10"})

Author: Stefan Urbanek stefan.urbanek@gmail.com License: MIT

About

Small extension library

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages