Skip to content

Implement new hook to modify application after creation but before instrument bootstrapping #114

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 18, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions microbootstrap/bootstrappers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ def bootstrap(self) -> ApplicationT:
**merge_dict_configs(resulting_application_config, self.bootstrap_before()),
)

self.bootstrap_before_instruments_after_app_created(application)

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

def bootstrap_before_instruments_after_app_created(self, application: ApplicationT) -> ApplicationT:
"""Add some framework-related parameters to bootstrap result after application creation, but before instruments are applied.""" # noqa: E501
return application

def bootstrap_after(self, application: ApplicationT) -> ApplicationT:
"""Add some framework-related parameters to final bootstrap result after application creation."""
return application
Expand Down
Loading