feat(cli): new launch banner with repo + build metadata#26
Conversation
Replaces the @-symbol AXOLOTL logo with the new axolotl-head + AXOLOTL letters art. Renders the GitHub URL and `vVERSION · <sha> · <date>` centered under the letters; sha/date are best-effort from `git`, falling back to just the version on non-git installs. Also wires `print_axolotl_text_art()` into `axolotl.cli.train:do_cli` so the banner shows when invoked via `python -m axolotl.cli.train` (e.g. under torchrun in custom launch scripts), and adds an `AXOLOTL_BANNER_PRINTED` env-var guard so the Click parent + spawned subprocess (`accelerate launch` / `torchrun -m`) print it only once.
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
📝 WalkthroughWalkthroughThe PR replaces the static Axolotl ASCII banner with a dynamically constructed logo that embeds the package version and optional git metadata (short SHA and commit date). It adds helper functions to retrieve git information and center text, updates the print function to prevent duplicate banner output using module-level and environment variable flags, and integrates the banner printing into the CLI startup flow. ChangesDynamic Banner with Git Metadata
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/axolotl/cli/art.py`:
- Around line 39-51: The _get_git_info() function calls subprocess.check_output
twice without timeouts and doesn't handle subprocess.TimeoutExpired; add a short
timeout (e.g., timeout=1 or 2 seconds) to both check_output calls and include
subprocess.TimeoutExpired in the except tuple alongside
subprocess.CalledProcessError, FileNotFoundError, and OSError so that a git hang
is treated as a fallback and the function returns (None, None) like other
failures.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: aba1fa50-357c-417e-bb25-336aa76da4ab
📒 Files selected for processing (2)
src/axolotl/cli/art.pysrc/axolotl/cli/train.py
| try: | ||
| sha = subprocess.check_output( # nosec B603 B607 | ||
| ["git", "-C", str(repo_root), "rev-parse", "--short", "HEAD"], | ||
| stderr=subprocess.DEVNULL, | ||
| text=True, | ||
| ).strip() | ||
| date = subprocess.check_output( # nosec B603 B607 | ||
| ["git", "-C", str(repo_root), "log", "-1", "--format=%cs"], | ||
| stderr=subprocess.DEVNULL, | ||
| text=True, | ||
| ).strip() | ||
| return sha or None, date or None | ||
| except (subprocess.CalledProcessError, FileNotFoundError, OSError): |
There was a problem hiding this comment.
Add a timeout (and handle TimeoutExpired) to _get_git_info() best-effort git probes
subprocess.check_output() calls in src/axolotl/cli/art.py (lines 40 and 45) have no timeout and _get_git_info() doesn’t catch subprocess.TimeoutExpired, so startup can block if git hangs. Add a short timeout to both calls and treat TimeoutExpired like the other fallbacks.
Suggested fix
try:
sha = subprocess.check_output( # nosec B603 B607
["git", "-C", str(repo_root), "rev-parse", "--short", "HEAD"],
stderr=subprocess.DEVNULL,
text=True,
+ timeout=1,
).strip()
date = subprocess.check_output( # nosec B603 B607
["git", "-C", str(repo_root), "log", "-1", "--format=%cs"],
stderr=subprocess.DEVNULL,
text=True,
+ timeout=1,
).strip()
return sha or None, date or None
- except (subprocess.CalledProcessError, FileNotFoundError, OSError):
+ except (
+ subprocess.CalledProcessError,
+ subprocess.TimeoutExpired,
+ FileNotFoundError,
+ OSError,
+ ):
return None, None🧰 Tools
🪛 Ruff (0.15.13)
[error] 40-40: subprocess call: check for execution of untrusted input
(S603)
[error] 41-41: Starting a process with a partial executable path
(S607)
[error] 45-45: subprocess call: check for execution of untrusted input
(S603)
[error] 46-46: Starting a process with a partial executable path
(S607)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/axolotl/cli/art.py` around lines 39 - 51, The _get_git_info() function
calls subprocess.check_output twice without timeouts and doesn't handle
subprocess.TimeoutExpired; add a short timeout (e.g., timeout=1 or 2 seconds) to
both check_output calls and include subprocess.TimeoutExpired in the except
tuple alongside subprocess.CalledProcessError, FileNotFoundError, and OSError so
that a git hang is treated as a fallback and the function returns (None, None)
like other failures.
|
📖 Documentation Preview: Deployed on Netlify from commit c7c8af4 |
Description
Updates banner and enables it to be invoked (only) once via
python -m axolotl.cli.trainandaccelerate launch/torchrun -m, also adds version and build to assist with log debuggingMotivation and Context
Boredom mostly
How has this been tested?
"$VENV_PY" -m axolotl.cli.main train --help | head -15"$VENV_PY" -m axolotl.cli.train /tmp/missing.yaml 2>&1 | head -15CUDA_VISIBLE_DEVICES="" "$TORCHRUN" --nproc_per_node=2 --master_port=29777 -m axolotl.cli.train /tmp/missing.yaml 2>&1 | grep -c "┌─┐┌─┐"(expect 1)AXOLOTL_BANNER_PRINTED=1 "$VENV_PY" -m axolotl.cli.train /tmp/missing.yaml 2>&1 | grep -c "┌─┐┌─┐"(expect 0)echo '{}' > /tmp/banner-empty.yaml && CUDA_VISIBLE_DEVICES="" "$VENV_PY" -m axolotl.cli.main train --launcher accelerate /tmp/banner-empty.yaml 2>&1 | grep -c "┌─┐┌─┐"(expect 1)"$VENV_PY" -c "import axolotl; axolotl.__file__='/tmp/fake/axolotl/__init__.py'; from axolotl.cli.art import print_axolotl_text_art; print_axolotl_text_art()"AI Usage Disclaimer
Claude Opus tested and did env check
Screenshots (if appropriate)
Renders as:
Types of changes
Solely Cosmetic