Package

The Package class is used for grouping and labeling a set of Controllers and Services. These components typically contain code that makes sense to modularize in the Application at hand.

Check out the Extensions docs to learn how Packages can be connected.

class aioli.Package(meta=None, auto_meta=False, controllers=None, services=None, config=None)[source]

Associates components and meta with a package, for registration with a Aioli Application.

Parameters:
  • meta – Package metadata, cannot be used with auto_meta
  • auto_meta – Attempt to automatically resolve meta for Package, cannot be used with meta
  • controllers – List of Controller classes to register with the Package
  • services – List of Services classes to register with the Package
  • config – Package Configuration Schema
Variables:
  • app – Application instance
  • meta – Package meta dictionary
  • log – Package logger
  • stash – Package Stash
  • config – Package config
  • controllers – List of Controllers registered with the Package
  • services – List of Services registered with the Package

Example – Creating a Package with Controller and Service layers

from aioli import Package

from .service import VisitService, VisitorService
from .controller import HttpController
from .config import ConfigSchema


export = Package(
    auto_meta=True,
    controllers=[HttpController],
    services=[VisitService, VisitorService],
    config=ConfigSchema,
)