Skip to content

fix: respect TYPER_USE_RICH in shell completion help text (fixes #1643)#1819

Closed
mshzy wants to merge 3 commits into
fastapi:masterfrom
mshzy:fix/rich-completion
Closed

fix: respect TYPER_USE_RICH in shell completion help text (fixes #1643)#1819
mshzy wants to merge 3 commits into
fastapi:masterfrom
mshzy:fix/rich-completion

Conversation

@mshzy
Copy link
Copy Markdown

@mshzy mshzy commented Jun 2, 2026

Problem

_sanitize_help_text() in _completion_classes.py only checked whether rich is installed via importlib.util.find_spec(). It did not respect HAS_RICH / TYPER_USE_RICH. Users with TYPER_USE_RICH=false still had Rich loaded during completions.

Fix

Import HAS_RICH from .core and check it before using Rich for help text sanitization.

Fixes #1643

mshzy and others added 3 commits June 2, 2026 18:26
_sanitize_help_text() checked whether rich is installed but
ignored the HAS_RICH flag from TYPER_USE_RICH env var. When
users set TYPER_USE_RICH=false, completions would still import
Rich. Fix: import HAS_RICH from .core and check it.

Fixes fastapi#1643
Copy link
Copy Markdown
Member

@svlandeg svlandeg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AI-generated spam, duplicating #1643. Previous duplicate PR #1818 was also closed and they just reopen.

@svlandeg svlandeg closed this Jun 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants