Package: py-rebar
py-rebarAnother python console application skeleton.Installingpipinstallpy-rebarFramework workflowThe py-rebar application scaffold provides for a series of plugin points for business logic to be added.graph TD;

    f_init(Framework init)
    f_argparse(argparse.ArgumentParser.parse_args)
    f_configlogging(Config logging)
    f_shut(Framework shutdown)

    p_init[/"Init plugins #quot;pyrebar.preinit#quot;"/]
    p_args[/"setup_args#40;parser#41; #quot;pyrebar.app#quot;"/]
    p_postinit[/"Post init #40;args#41; #quot;pyrebar.postinit#quot;"/]
    p_exec[/"execute#40;args#41; #quot;pyrebar.app#quot;"/]
    p_shut[/"shutdown#40;#41; #quot;pyrebar.shutdown#quot;"/]

    f_init --> p_init
    p_init --Foreach pre-init-->p_init
    p_init --> p_args
    p_args --Foreach app-->p_args
    p_args --> f_argparse
    f_argparse --> f_configlogging
    f_configlogging --> p_postinit
    p_postinit --Foreach post-init-->p_postinit
    p_postinit --> p_exec
    p_exec --> p_shut
    p_shut --Foreach post-app shutdown--> p_shut
    p_shut --> f_shutEntryPointsPy-rebar provides several plugin points to add the business logic to this framework.  This is done through python'sentrypoint plugin architecture. A boostrap mechanism is available for scripts being run directly, rather than relying on installed modules.Each of the entrypoint groups listed here is defined by as{prefix}.{group}. These groups are defined assuming the default prefix ofpyrebar. Applications can override the default prefix by callingpyrebar.application.mainwith a prefix.pre_initApplication initializers can be added an entrypoint with the{prefix}.pre_initgroup. These entrypoints must be a function that takes an optionalparser=keyword argument. The provided parser is the root command line parser.It is important to note that all installedpre_initentrypoint functions will be called prior to continuing. Any exceptions raised will cause the application to terminate.post_initApplication initializers added to the{prefix}.post_initgroup will be called after the command line is parsed and logging is configured, but before the main application is execution. These entrypoints must be a function that takes an optionalargs=parameter. The provided value will be anargparse.Namespaceobject holding the output ofargparse.ArgumentParser.parse_args()function.It is important to note that all installedpre_initentrypoint functions will be called prior to continuing. Any exceptions raised will trigger shutdown processing and cause the application to terminate.appApplication entrypoints added to the{prefix}.appmust point to a python module. These modules contain one or more of the following specially-named variables and functions described below.If multiple applications are found, they are registered as subcommands using theEntryPoint.nameproperty.Variables (all are optional):SUBCOMMAND: str- If multiple apps are found, this overrides theEntryPoint.nameas the subcommand name.ALIASES: list[str]- If multiple apps are found, this list provides the set of command aliases.LOGGER_NAME: str- The application logger name. If not specified, the module name is used.Functions:config_args(parser:argparse.ArgumentParser)-[optional]If specified, this function is called with the command line argument parser. If only one application is found, this will be the base parser. If multiple applications are found, this will be the subparser.execute(args:argparse.Namespace=None) -> int- The main application execution function. Called with the parsed command line arguments. The return value is passed to asys.exit()call and thus is passed back to the OS.shutdownApplication shutdown hooks can be added to the{prefix}.shutdowngroup.  These entrypoints must point to a function that will be called without arguments.These shutdown hooks are called before the application exits. Note that these hooks will be called even when an exception is raised out of thepre_initorpost_inithooks.  Any shutdown hook closing resources opened during an init phase must therefore handle the case the opening failed or was never called.BootstrappingFor applications run directly, rather than built + installed, there are 2 options for bootstrapping:Configure the entrypoints inpyproject.tomlas described by thesetuptools documentation. Then, callpyrebar.bootstrap_from_pyproject('path/to/pyproject.toml').AdditionalEntryPointinstances can be explictly added in a__main__.pyusing thepyrebar.Plugins.add_entrypoint()method.ExamplesSee the examples in thesrc/appsdirectory.