Version: 8.0
Module: factory.core
Inherits from: ObjData.ObjData
ObjPackage is the runtime package identity and governance module. It provides a single entry point for package identity (name, branding, contacts), RACI governance, and active database connection resolution.
Loads package metadata from def_package and exposes it via properties:
pkg = ObjPackage()
pkg.load() # or pkg.load("homechoice")
print(pkg.name) # "HomeChoice"
print(pkg.contacts) # "team@example.com,ops@example.com"
print(pkg.archetype) # "homechoice"
print(pkg.palette_name) # "homechoice_5"
Uses the ObjRaci mixin to provide RACI matrices at the package level:
pkg = ObjPackage()
raci = pkg.get_raci_for_package()
html = pkg.build_raci_html(raci)
RACI data is stored in def_package.RaciSimulation, RaciProduction, RaciOutcome as pipe-delimited email lists (R|A|C|I).
Resolves the database.active key from config.yaml to route connections to the correct database:
pkg = ObjPackage()
name = pkg.get_active_connection_name() # e.g. "dev"
cfg = pkg.get_active_db_config() # full connection dict
# Fix all connections at startup
ObjPackage.fix_connect_db()
fix_connect_db() patches Objects.Connection.connect_db so that when config_name="primary" is passed (the default), it substitutes the active connection name instead. This fixes the issue where connect_db() hardcodes "primary" and ignores the active key in config.yaml.
# Show package identity
python factory.core/ObjPackage.py identity
python factory.core/ObjPackage.py identity homechoice
# Show active database connection
python factory.core/ObjPackage.py active-db
# Show RACI matrix
python factory.core/ObjPackage.py raci
python factory.core/ObjPackage.py raci --refresh
The active key in config.yaml controls which named connection is used:
homechoice:
database:
active: dev # ← ObjPackage reads this
connections:
primary:
db: hcapi.live
dev:
db: hcplanning.dev
Without ObjPackage.fix_connect_db(), all connections default to primary regardless of the active key.
| Property | Source Column | Description |
|---|---|---|
name |
Name | Display name |
description |
Description | Package description |
contacts |
ContactList | Comma-separated emails |
logo |
DefaultLogo | Logo file path |
palette_name |
DefaultPallete | Colour palette name |
archetype |
Archetype | Parent package for inheritance |