Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
Overhang.IO committed Dec 15, 2023
2 parents f52dda4 + afb85aa commit 9035965
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- [Feature] add `CONFIG_INTERACTIVE` action that allows tutor plugins to interact with the configuration at the time of the interactive questionnaire that happens during tutor local launch. (by @Alec4r).
6 changes: 6 additions & 0 deletions tutor/hooks/catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ def run_this_on_start(root, config, name):
#: :parameter str name: docker-compose project name.
COMPOSE_PROJECT_STARTED: Action[[str, Config, str]] = Action()

#: Triggered after all interactive questions have been asked.
#: You should use this action if you want to add new questions.
#:
#: :parameter dict config: project configuration.
CONFIG_INTERACTIVE: Action[[Config]] = Action()

#: This action is called at the end of the tutor.config.load_full function.
#: Modifying this object will not trigger changes in the configuration.
#: For all purposes, it should be considered read-only.
Expand Down
4 changes: 3 additions & 1 deletion tutor/interactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import click

from . import config as tutor_config
from . import env, exceptions, fmt
from . import env, exceptions, fmt, hooks
from .types import Config, get_typed


Expand Down Expand Up @@ -149,6 +149,8 @@ def ask_questions(config: Config, run_for_prod: Optional[bool] = None) -> None:
defaults,
)

hooks.Actions.CONFIG_INTERACTIVE.do(config)


def ask(question: str, key: str, config: Config, defaults: Config) -> None:
default = get_typed(defaults, key, str)
Expand Down

0 comments on commit 9035965

Please sign in to comment.