Skip to content

Commit

Permalink
feat: add explicit CLI import error (#1785)
Browse files Browse the repository at this point in the history
* feat: add explicit CLI import error

* Proofread error msg

---------

Co-authored-by: Kumaran Rajendhiran <[email protected]>
  • Loading branch information
Lancetnik and kumaranvpl authored Sep 12, 2024
1 parent 98e94aa commit 0d56ef1
Showing 1 changed file with 14 additions and 1 deletion.
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

0 comments on commit 0d56ef1

Please sign in to comment.