Skip to content

Commit 485ddf7

Browse files
authored
Implement new hook to modify application after creation but before instrument bootstrapping (#114)
1 parent 5db73e8 commit 485ddf7

File tree

1 file changed

+6
-0
lines changed
  • microbootstrap/bootstrappers

1 file changed

+6
-0
lines changed

microbootstrap/bootstrappers/base.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,8 @@ def bootstrap(self) -> ApplicationT:
8888
**merge_dict_configs(resulting_application_config, self.bootstrap_before()),
8989
)
9090

91+
self.bootstrap_before_instruments_after_app_created(application)
92+
9193
for instrument in self.instrument_box.instruments:
9294
if instrument.is_ready():
9395
application = instrument.bootstrap_after(application)
@@ -98,6 +100,10 @@ def bootstrap_before(self) -> dict[str, typing.Any]:
98100
"""Add some framework-related parameters to final bootstrap result before application creation."""
99101
return {}
100102

103+
def bootstrap_before_instruments_after_app_created(self, application: ApplicationT) -> ApplicationT:
104+
"""Add some framework-related parameters to bootstrap result after application creation, but before instruments are applied.""" # noqa: E501
105+
return application
106+
101107
def bootstrap_after(self, application: ApplicationT) -> ApplicationT:
102108
"""Add some framework-related parameters to final bootstrap result after application creation."""
103109
return application

0 commit comments

Comments
 (0)