Repository: canonical/snapcraft

Issue:
 Integrate craft-cli's "streaming brief" mode into Snapcraft
### What needs to get done

After releasing a new version of craft-cli, craft-parts and craft-

- Update Snapcraft's emit.init() call to enable "streaming brief";
- Review Snapcraft-specific messages (running the linters, creating the snap, etc) to ensure they make sense in this new mode.


### Why it needs to get done

The goal of the feature is to give a bit more progress feedback to the users.


Discussion:

Resolving patch:
diff --git a/snapcraft/cli.py b/snapcraft/cli.py
--- a/snapcraft/cli.py
+++ b/snapcraft/cli.py
@@ -201,6 +201,7 @@ def get_dispatcher() -> craft_cli.Dispatcher:
         appname="snapcraft",
         greeting=f"Starting Snapcraft {__version__}",
         log_filepath=log_filepath,
+        streaming_brief=True,
     )
 
     return craft_cli.Dispatcher(
diff --git a/snapcraft/commands/lint.py b/snapcraft/commands/lint.py
--- a/snapcraft/commands/lint.py
+++ b/snapcraft/commands/lint.py
@@ -23,7 +23,7 @@
 import tempfile
 import textwrap
 from contextlib import contextmanager
-from pathlib import Path
+from pathlib import Path, PurePosixPath
 from typing import Iterator, Optional
 
 from craft_cli import BaseCommand, emit
@@ -309,7 +309,7 @@ def _install_snap(
         is_dangerous = not bool(assert_file)
 
         if assert_file:
-            ack_command = snap_cmd.formulate_ack_command(assert_file)
+            ack_command = snap_cmd.formulate_ack_command(PurePosixPath(assert_file))
             emit.progress(
                 f"Installing assertion file with {shlex.join(ack_command)!r}."
             )
@@ -327,7 +327,7 @@ def _install_snap(
         install_command = snap_cmd.formulate_local_install_command(
             classic=bool(snap_metadata.confinement == "classic"),
             dangerous=is_dangerous,
-            snap_path=snap_file,
+            snap_path=PurePosixPath(snap_file),
         )
         if snap_metadata.grade == "devel":
             install_command.append("--devmode")
diff --git a/snapcraft/parts/lifecycle.py b/snapcraft/parts/lifecycle.py
--- a/snapcraft/parts/lifecycle.py
+++ b/snapcraft/parts/lifecycle.py
@@ -377,7 +377,7 @@ def _run_lifecycle_and_pack(
             version=process_version(project.version),
             target_arch=project.get_build_for(),
         )
-        emit.message(f"Created snap package {snap_filename}")
+        emit.progress(f"Created snap package {snap_filename}", permanent=True)
 
 
 def _generate_metadata(


Test patch:
diff --git a/tests/unit/conftest.py b/tests/unit/conftest.py
--- a/tests/unit/conftest.py
+++ b/tests/unit/conftest.py
@@ -25,6 +25,7 @@
 import yaml
 from craft_providers import Executor, Provider
 from craft_providers.base import Base
+from overrides import override
 from pymacaroons import Caveat, Macaroon
 
 from snapcraft.extensions import extension, register, unregister
@@ -326,6 +327,16 @@ def fake_provider(mock_instance):
     class FakeProvider(Provider):
         """Fake provider."""
 
+        @property
+        @override
+        def name(self) -> str:
+            return "fake"
+
+        @property
+        @override
+        def install_recommendation(self) -> str:
+            return "uninstallable"
+
         def clean_project_environments(self, *, instance_name: str):
             pass