Skip to content

Python 3.11 compat: f-string backslash in cli_hub/preview.py line 723 #367

Description

@reinocheong

Bug: cli-hub crashes on Python 3.11 with SyntaxError: f-string expression part cannot include a backslash.

Root cause: In cli_hub/preview.py line 723:

f'<div class="trajectory-list">{items_html or "<div class=\\"artifact-file\\">No step timeline entries yet.</div>"}</div>'

Python 3.11 does not allow backslashes inside f-string expression groups {...}. This was relaxed in Python 3.12+ (PEP 701).

Fix: Extract the fallback string to a variable outside the f-string:

_empty_trajectory = '<div class="artifact-file">No step timeline entries yet.</div>'
f'<div class="trajectory-list">{items_html or _empty_trajectory}</div>'

Verified fix passes lint and cli-hub works normally on Python 3.11.15 after the change.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions