Skip to content

Commit 03e80ad

Browse files
km-64jell-o-fishi
andauthored
Fix entrypoint for console script (#336)
* Fix entrypoint * Add asyncclick import check for console script * Make console script exit if required imports aren't found --------- Co-authored-by: jell-o-fishi <[email protected]>
1 parent 244c36c commit 03e80ad

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

rsocket/cli/command.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
import asyncio
22
import logging
33
import ssl
4+
import sys
45
from contextlib import asynccontextmanager
56
from dataclasses import dataclass
67
from enum import Enum, unique
78
from importlib.metadata import version as get_version
89
from typing import Optional, Type, Collection, List, Callable
910

10-
import asyncclick as click
11+
try:
12+
import asyncclick as click
13+
except ImportError:
14+
print("This command requires the CLI extra.")
15+
print("Install with: pip install rsocket[cli]")
16+
sys.exit(1)
1117

1218
from rsocket.awaitable.awaitable_rsocket import AwaitableRSocket
1319
from rsocket.extensions.helpers import route, composite, authenticate_simple, authenticate_bearer

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ channels =
7070
asyncwebsockets = asyncwebsockets>=0.9.4
7171

7272
[options.entry_points]
73-
cli.console_scripts =
73+
console_scripts =
7474
rsocket-py = rsocket.cli.command:command
7575

7676
[tool:pytest]

0 commit comments

Comments
 (0)