Skip to content

[codex] Add lifecycle hooks#131

Merged
ItayTheDar merged 1 commit into
mainfrom
inexpensive-polyester
May 13, 2026
Merged

[codex] Add lifecycle hooks#131
ItayTheDar merged 1 commit into
mainfrom
inexpensive-polyester

Conversation

@ItayTheDar
Copy link
Copy Markdown
Contributor

Summary

Adds NestJS-style lifecycle hooks for providers and module classes:

  • OnModuleInit
  • OnApplicationBootstrap
  • BeforeApplicationShutdown
  • OnModuleDestroy
  • OnApplicationShutdown

The container now runs boot hooks after DI construction and runs shutdown hooks through app.close(). The FastAPI lifespan wrapper closes the PyNest app on server shutdown, and app.enable_shutdown_hooks() wires SIGTERM/SIGINT to graceful shutdown.

Validation

  • uv run pytest -q -> 167 passed, 8 warnings

Closes #113

@ItayTheDar ItayTheDar marked this pull request as ready for review May 13, 2026 10:32
@ItayTheDar ItayTheDar merged commit e5b29b9 into main May 13, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Lifecycle Hooks (OnModuleInit, OnApplicationBootstrap, OnModuleDestroy)

1 participant