Package¶
A Package is a namespaced and labelled group of components that can be imported into an Application
.
There are two main components for building Web API Packages: Controller & Service
When developing an Aioli application, local Packages typically contain code that makes sense to modularize in the Application at hand.
-
class
aioli.
Package
(name, description, version, controllers=None, services=None, config=None)[source]¶ Associates components and meta with a package, for registration with a Aioli Application.
- Parameters
name – Package name ([a-z, A-Z, 0-9, -])
description – Package description
version – Package semver version
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
log – Package logger
state – Package state
path – Package Path
name – Package Name
version – Package Version
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(
name="aioli_guestbook",
version="0.1.0",
description="Example guestbook Package",
controllers=[HttpController],
services=[VisitService, VisitorService],
config=ConfigSchema,
)