Framework
Creating your first framework using the S.P.O.C foundation is an exciting endeavor that empowers you to construct powerful and flexible applications with ease. A framework serves as a structured blueprint that streamlines development, promotes consistency, and accelerates the creation of feature-rich projects.
framework/framework.py
# -*- coding: utf-8 -*-
"""{ Core } Read The Docs"""
import spoc
import click
PLUGINS = ["commands"]
@click.group()
def cli():
"Click Main"
@spoc.singleton
class MyFramework:
"""Framework"""
def init(
self,
):
"""Class __init__ Replacement"""
framework = spoc.App(plugins=PLUGINS)
# Run Extras
before_server = framework.extras['before_server']
for method in before_server:
method()
# INIT Command(s) Sources
command_sources = [cli]
# Collect All Commands
for active in framework.component.commands.values():
command_sources.append(active.object)
title = "My Project"
help_text = f"""
Welcome to { title }
"""
self.cli = click.CommandCollection(
name=title,
help=help_text,
sources=command_sources
)