Problem
The Scope enum is fixed with 5 levels: APP=1, SESSION=2, REQUEST=3, ACTION=4, STEP=5. Applications with non-standard lifecycle requirements (background-job scope, tenant scope, etc.) cannot express their needs.
Proposed Solution
Allow extending Scope with custom values while preserving ordering. Users could subclass Scope and add values:
class MyScope(Scope):
TENANT = 6
BACKGROUND_JOB = 7
As long as integer ordering is preserved, the existing scope hierarchy logic should work.
Impact
Flexibility for non-standard lifecycle requirements.
Complexity
Low — IntEnum supports extension; main work is ensuring build_child_container and find_container handle custom values.
Problem
The
Scopeenum is fixed with 5 levels:APP=1, SESSION=2, REQUEST=3, ACTION=4, STEP=5. Applications with non-standard lifecycle requirements (background-job scope, tenant scope, etc.) cannot express their needs.Proposed Solution
Allow extending
Scopewith custom values while preserving ordering. Users could subclassScopeand add values:As long as integer ordering is preserved, the existing scope hierarchy logic should work.
Impact
Flexibility for non-standard lifecycle requirements.
Complexity
Low —
IntEnumsupports extension; main work is ensuringbuild_child_containerandfind_containerhandle custom values.