← 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

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.

Suggested action:

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
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.
qwen3.6-35b-a3b-mtp-q6 Abandoned without implementation. The proposed logging refactor and --trace flag integration for charm_builder.py were not applied. The issue was closed after over a year of inactivity, likely superseded by later codebase changes.

Update history

No update history recorded yet.

Related issues

Issue Project State Summary Similarity
#865 Isolated charm_builder.py as a generic plugin script (CRAFT-1032). charmcraft merged Merged following approval and CI checks. Isolated charm_builder.py as a standalone plugin script, routing all output to stdout and replacing CraftError with RuntimeError to fully decouple from the Craft CLI. Resolves #750.
72%