Fix: Python 3.11 compatibility issue with f-string backslash in cli_hub/preview.py (#377)

* Fix Python 3.11 compatibility issue in cli_hub/preview.py

* fix(cli-hub): remove backslash from f-string expression for pre-3.12

The prior change swapped the inner double quotes for single quotes, but
pre-3.12 (before PEP 701) prohibits a backslash ANYWHERE in the
expression part of an f-string — the escaped quote left a backslash in
place, so preview.py still raised SyntaxError on Python 3.10/3.11.

Hoist the fallback markup into an empty_message variable so the f-string
expression contains no backslash. This also restores the original
double-quoted HTML (class="artifact-file"); the rendered output is now
byte-for-byte identical to origin/main.

* chore(cli-hub): bump version to 0.4.1

Ships the pre-3.12 f-string fix in preview.py to PyPI. Without a version
bump publish-cli-hub.yml sees 0.4.0 already on PyPI and skips, so users on
Python 3.10/3.11 would keep installing the broken release.

---------

Co-authored-by: yuhao <itsyuhao@icloud.com>
This commit is contained in:
Rāna(Bass Ver.)
2026-07-09 20:03:58 +08:00
committed by GitHub
parent dc73924892
commit b04a4ebe26
3 changed files with 4 additions and 3 deletions
+1 -1
View File
@@ -1,3 +1,3 @@
"""cli-hub — Download, manage, and browse CLI-Anything harnesses."""
__version__ = "0.4.0"
__version__ = "0.4.1"
+2 -1
View File
@@ -716,11 +716,12 @@ def _render_trajectory_html_section(trajectory: Optional[Dict[str, Any]]) -> str
for item in items
)
empty_message = '<div class="artifact-file">No step timeline entries yet.</div>'
return (
'<section class="section">'
"<h2>Trajectory</h2>"
f'<div class="facts">{cards_html}</div>'
f'<div class="trajectory-list">{items_html or "<div class=\"artifact-file\">No step timeline entries yet.</div>"}</div>'
f'<div class="trajectory-list">{items_html or empty_message}</div>'
"</section>"
)
+1 -1
View File
@@ -50,7 +50,7 @@ class sdist(_sdist):
setup(
name="cli-anything-hub",
version="0.4.0",
version="0.4.1",
description="Package manager for CLI-Anything — browse, install, and manage 40+ agent-native CLI interfaces for GUI applications",
long_description=open("README.md").read(),
long_description_content_type="text/markdown",