-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Closed
Labels
designIncludes a design discussionIncludes a design discussionfeatureIs an improvement or enhancementIs an improvement or enhancementlightningclipl.cli.LightningCLIpl.cli.LightningCLI
Description
Description & Motivation
Adds a after_instantiate_classes
hook to the Lightning CLI, called after self.instantiate_classes()
during the initalization of LightningCLI
.
Pitch
While having the Lightning CLI is great, it is not perfect for each use case out-of-the-box. Hence, you included hooks like before_instantiate_classes
and describe in the docs how to extend the CLI. Problem is, you cannot extend this feature without hacks or substantial copy-pasta.
I think, to further improve the CLI, without adding any complexity, it makes sense to add a after_instantiate_classes
hook, too.
Alternatives
- Hacks
- Extend the Lightning CLI and run the
after_instantiate_classes
function before theself._run_subcommand
function. - Problems: it's not intuitive that the function is called there, won't be called if
self.subcommand is None
- Copy-Pasta
- Extend the Lightning CLI and replace the original
__init__
with the proposed one. - Problems: could break with any update, lots of code duplication
Additional context
No response
Metadata
Metadata
Assignees
Labels
designIncludes a design discussionIncludes a design discussionfeatureIs an improvement or enhancementIs an improvement or enhancementlightningclipl.cli.LightningCLIpl.cli.LightningCLI