mafw.scaffold.prompting

Interactive prompts and success reporting for project scaffolding.

author:

Bulgheroni Antonio

mafw.scaffold.prompting._prompt_author_email(value: str | None, default: str) → str[source]

Prompt for a well-formed author e-mail, re-prompting up to three times.

A malformed e-mail would make the generated project’s build backend fail, so the address is validated here and the user is asked again on invalid input.

Parameters:
  • value (str | None) – The e-mail supplied on the command line, if any.

  • default (str) – The default e-mail used when the user accepts the prompt.

Returns:

A validated e-mail address.

Return type:

str

Raises:

mafw.scaffold.errors.ScaffoldError – If no valid e-mail is provided in time.

mafw.scaffold.prompting._prompt_optional(label: str, value: str | None, default: str) → str[source]

Prompt for an optional value, showing and accepting a default.

Parameters:
  • label (str) – The human-readable label for the prompt.

  • value (str | None) – The value supplied on the command line, if any.

  • default (str) – The default used when the user accepts the prompt.

Returns:

The resolved value.

Return type:

str

mafw.scaffold.prompting._prompt_project_name(project_name: str | None) → str[source]

Prompt for a valid project name, re-prompting up to three times.

Parameters:

project_name (str | None) – The name supplied on the command line, if any.

Returns:

A validated project name.

Return type:

str

Raises:

mafw.scaffold.errors.ScaffoldError – If a valid name is not provided within the attempts.

mafw.scaffold.prompting._report_success(spec: ProjectSpec, project_dir: Path, install: str | None) → None[source]

Print the post-generation summary and next-step commands.

Parameters:
  • spec (mafw.scaffold.spec.ProjectSpec) – The validated project specification.

  • project_dir (pathlib.Path) – The absolute path to the generated project.

  • install (str | None) – The install manager requested, if any.