From cd3539c2065009d282a33381fd9c21726df3d3e2 Mon Sep 17 00:00:00 2001 From: km-64 <79924100+km-64@users.noreply.github.com> Date: Fri, 26 Sep 2025 19:55:32 +0200 Subject: [PATCH 1/3] Fix entrypoint --- setup.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.cfg b/setup.cfg index 3a579613..440915e4 100644 --- a/setup.cfg +++ b/setup.cfg @@ -70,7 +70,7 @@ channels = asyncwebsockets = asyncwebsockets>=0.9.4 [options.entry_points] -cli.console_scripts = +console_scripts = rsocket-py = rsocket.cli.command:command [tool:pytest] From 9ac56c2d3762c5925ff2cae860dee75e30a28783 Mon Sep 17 00:00:00 2001 From: km-64 <79924100+km-64@users.noreply.github.com> Date: Sun, 28 Sep 2025 15:31:18 +0200 Subject: [PATCH 2/3] Add asyncclick import check for console script --- rsocket/cli/command.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rsocket/cli/command.py b/rsocket/cli/command.py index 731df7da..01a4d87b 100644 --- a/rsocket/cli/command.py +++ b/rsocket/cli/command.py @@ -7,7 +7,11 @@ from importlib.metadata import version as get_version from typing import Optional, Type, Collection, List, Callable -import asyncclick as click +try: + import asyncclick as click +except ImportError: + print("This command requires the CLI extra.") + print("Install with: pip install rsocket[cli]") from rsocket.awaitable.awaitable_rsocket import AwaitableRSocket from rsocket.extensions.helpers import route, composite, authenticate_simple, authenticate_bearer From b3c39efdf5dd7cfe8c5baa2a5be7621af32d031c Mon Sep 17 00:00:00 2001 From: km-64 <79924100+km-64@users.noreply.github.com> Date: Sun, 28 Sep 2025 15:34:11 +0200 Subject: [PATCH 3/3] Make console script exit if required imports aren't found --- rsocket/cli/command.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rsocket/cli/command.py b/rsocket/cli/command.py index 01a4d87b..0221c2ce 100644 --- a/rsocket/cli/command.py +++ b/rsocket/cli/command.py @@ -1,6 +1,7 @@ import asyncio import logging import ssl +import sys from contextlib import asynccontextmanager from dataclasses import dataclass from enum import Enum, unique @@ -12,6 +13,7 @@ except ImportError: print("This command requires the CLI extra.") print("Install with: pip install rsocket[cli]") + sys.exit(1) from rsocket.awaitable.awaitable_rsocket import AwaitableRSocket from rsocket.extensions.helpers import route, composite, authenticate_simple, authenticate_bearer