Skip to content

DataBrewery/extensible

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

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 [email protected] License: MIT

Releases

No releases published

Packages

No packages published

Languages