← Back to issue list

Convert charm_builder.py to a regular external script

View original Github issue

Metadata

Project
charmcraft
Number
#750
Type
issue
State
closed
Author
facundobatista
Labels
—
Created
Updated
Closed

Current evaluation

Converted charm_builder.py into a standalone script with plain stdout logging and RuntimeError handling via merged PR #865 (commit 56242113).

Resolution: closed resolved

Reason: Merged PR #865 resolved the legacy Craft CLI integration by isolating charm_builder.py as a generic plugin script. The change replaced Emitter output with stdout logging and CraftError with RuntimeError.

Evaluated by: mr-cal-bot

No scores available.

Issue body

Currently it uses Craft CLI, but that is because legacy reasons (it was integrated to the rest of Charmcraft code before), and it relies in its functionality but as it's run as a script, it's not used (e.g., showing progress). Furthermore, the added timestamp dirties the logs. So instead of using the Emitter, we should set up a logging infrastructure that will just show the message to the terminal (no timestamp, no log level, etc), and transform the 14 `emit.trace` calls in `logger.debug` and the 5 `emit.progress` calls in `logger.info`. By default the logger level should be INFO, but if the script is run with a `--trace` flag it should change to DEBUG. When preparing the script to run, in the `charm` plugin, we should use that flag in some cases: - if Charmcraft is run in quiet or normal mode, `charm_builder.py` should be called without the flag (nothing will be seen, its INFO lines will be saved into the logs) - if Charmcraft is run in verbose mode, `charm_builder.py` should be called without the flag (its INFO lines will be seen and saved into the logs) - if Charmcraft is run in trace mode, `charm_builder.py` should be called **with** the flag (its INFO and DEBUG lines will be seen and saved into the logs) We also should stop raising CraftError as it just means a crash.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Converted charm_builder.py into a standalone script with plain stdout logging and RuntimeError handling via merged PR #865 (commit 56242113).
stealth/space-bunny-alpha — closed resolved Converted charm_builder.py to a standalone generic plugin in merged PR #865, using stdout output and RuntimeError instead of Craft CLI logging and CraftError.
qwen3.6-35b-a3b-mtp-q6 — — Closed without implementation. The proposal to replace Craft CLI's Emitter with standard Python logging in charm_builder.py, add a --trace flag, and adjust log levels per Charmcraft mode was abandoned. No follow-up PR or resolution occurred.
qwen/qwen3.6-35b-a3b — — Closed without implementation. The proposal to refactor charm_builder.py to standard logging with a --trace flag and remove Craft CLI dependencies was abandoned.
qwen3.6-35b-a3b-mtp-q6 — — Closed without implementation. The proposal to refactor charm_builder.py to use standard logging with a --trace flag and remove Craft CLI dependencies was abandoned due to lack of activity.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#865 (confidence 100%)

    PR #865 was merged as commit 56242113 and explicitly fixes issue #750.

Related issues

Issue Project State Summary Similarity
#865 Isolated charm_builder.py as a generic plugin script (CRAFT-1032). charmcraft merged Merged as commit 56242113, isolating charm_builder.py as a standalone plugin with stdout output and RuntimeError, fixing #750.
77%