Affected Software/Harness
cli-hub
Version / Commit
latest (main branch commit: dc73924)
Operating System
macOS
Python Version
3.10+
Steps to Reproduce
- Install cli-hub:
pip install cli-anything-hub
- Run:
cli-hub list
- See SyntaxError occur
Expected Behavior
The cli-hub list command should execute successfully and display the list of available CLIs.
Actual Behavior
A SyntaxError is raised during module import:
SyntaxError: f-string expression part cannot include a backslash
The error prevents the entire cli-hub CLI from loading.
Relevant Logs / Tracebacks
Traceback (most recent call last):
File "/opt/homebrew/bin/cli-hub", line 3, in <module>
from cli_hub.cli import main
File "/opt/homebrew/lib/python3.10/site-packages/cli_hub/cli.py", line 46, in <module>
from cli_hub.preview import (
File "/opt/homebrew/lib/python3.10/site-packages/cli_hub/preview.py", line 725
)
^
SyntaxError: f-string expression part cannot include a backslash
Additional Context
Root Cause:
In cli-hub/cli_hub/preview.py line 723, the _render_trajectory_html_section() function contains an f-string with escaped quotes in the expression:
f'<div class="trajectory-list">{items_html or "<div class=\"artifact-file\">No step timeline entries yet.</div>"}</div>'
Python 3.10+ prohibits backslashes inside f-string expression curly braces {}.
Fix:
Extract the nested HTML string to a variable before using it in the f-string:
empty_message = '<div class="artifact-file">No step timeline entries yet.</div>'
items_html = "..." # existing computation
return (
'<section class="section">'
"<h2>Trajectory</h2>"
f'<div class="facts">{cards_html}</div>'
f'<div class="trajectory-list">{items_html or empty_message}</div>'
"</section>"
)
This maintains full functionality while avoiding backslashes in f-string expressions.
Affected Software/Harness
cli-hub
Version / Commit
latest (main branch commit: dc73924)
Operating System
macOS
Python Version
3.10+
Steps to Reproduce
pip install cli-anything-hubcli-hub listExpected Behavior
The
cli-hub listcommand should execute successfully and display the list of available CLIs.Actual Behavior
A SyntaxError is raised during module import:
The error prevents the entire cli-hub CLI from loading.
Relevant Logs / Tracebacks
Additional Context
Root Cause:
In
cli-hub/cli_hub/preview.pyline 723, the_render_trajectory_html_section()function contains an f-string with escaped quotes in the expression:f'<div class="trajectory-list">{items_html or "<div class=\"artifact-file\">No step timeline entries yet.</div>"}</div>'Python 3.10+ prohibits backslashes inside f-string expression curly braces
{}.Fix:
Extract the nested HTML string to a variable before using it in the f-string:
This maintains full functionality while avoiding backslashes in f-string expressions.