Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add explicit CLI import error #1785

Merged
merged 2 commits into from
Sep 12, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 14 additions & 1 deletion faststream/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,20 @@

import warnings

from faststream.cli.main import cli
try:
from faststream.cli.main import cli
except ImportError:
has_typer = False
else:
has_typer = True

if not has_typer:
raise ImportError(
"\n\nYou're trying to use the FastStream CLI, "
"\nbut you haven't installed the required dependencies."
"\nPlease install them using the following command: "
'\npip install "faststream[cli]"'
)

warnings.filterwarnings("default", category=ImportWarning, module="faststream")

Expand Down
Loading