mafw.scaffold.installer
Optional installation of a generated project.
When the user passes --install to mafw init, the newly generated project
is installed into its own environment. The scaffolding service never implements
virtual-environment creation or dependency resolution itself: it delegates the
whole operation to a supported project manager (Hatch by default), using the
shared mafw.tools.shell_tools.run() helper.
If the delegated installation fails, the generated sources are left untouched and the caller receives the manual commands needed to finish the installation by hand.
Added in version 2.4.
Module Attributes
Project manager used when |
Functions
|
Install a generated project by delegating to a supported project manager. |
Classes
|
Result of an optional installation attempt. |
- class mafw.scaffold.installer.InstallOutcome(succeeded: bool, manager: str, manual_commands: tuple[str, ...])[source]
Bases:
objectResult of an optional installation attempt.
- Variables:
succeeded – Whether the delegated installation completed successfully.
manager – The project manager that was used.
manual_commands – Commands the user can run to finish installation by hand (populated when the installation failed or was impossible).
- mafw.scaffold.installer._manual_commands(project_dir: Path, manager: str) tuple[str, ...][source]
Return the manual commands that complete installation for
manager.- Parameters:
project_dir (Path) – The generated project directory.
manager (str) – The selected project manager.
- Returns:
A tuple of shell command strings.
- Return type:
tuple[str, …]
- mafw.scaffold.installer.install_project(project_dir: Path, manager: str | None = None) InstallOutcome[source]
Install a generated project by delegating to a supported project manager.
- Parameters:
project_dir (Path) – The generated project directory to install.
manager (str | None) – The manager to use; defaults to
DEFAULT_MANAGER.
- Returns:
The outcome describing success and any manual recovery commands.
- Return type:
- mafw.scaffold.installer.DEFAULT_MANAGER = 'hatch'
Project manager used when
--installis given without an explicit choice.