From 3c62503261f899ebd6f0cdbb6222d8052f842ef2 Mon Sep 17 00:00:00 2001 From: Aymeric Augustin Date: Tue, 25 Feb 2025 09:20:52 +0100 Subject: [PATCH] Use entrypoint instead of runpy in docs. --- docs/deploy/fly.rst | 6 +++--- docs/deploy/haproxy.rst | 2 +- docs/deploy/heroku.rst | 6 +++--- docs/deploy/koyeb.rst | 6 +++--- docs/deploy/kubernetes.rst | 6 +++--- docs/deploy/nginx.rst | 2 +- docs/deploy/render.rst | 6 +++--- docs/deploy/supervisor.rst | 7 +++---- docs/howto/django.rst | 4 ++-- docs/index.rst | 2 +- docs/intro/tutorial1.rst | 4 ++-- docs/intro/tutorial3.rst | 2 +- src/websockets/__main__.py | 2 +- 13 files changed, 27 insertions(+), 28 deletions(-) diff --git a/docs/deploy/fly.rst b/docs/deploy/fly.rst index 4262e8aeb..6202fb14a 100644 --- a/docs/deploy/fly.rst +++ b/docs/deploy/fly.rst @@ -130,7 +130,7 @@ name of your Fly app in this command: .. code-block:: console - $ python -m websockets wss://websockets-echo.fly.dev/ + $ websockets wss://websockets-echo.fly.dev/ Connected to wss://websockets-echo.fly.dev/. > @@ -152,7 +152,7 @@ with your app: .. code-block:: console - $ python -m websockets wss://websockets-echo.fly.dev/ + $ websockets wss://websockets-echo.fly.dev/ Connected to wss://websockets-echo.fly.dev/. > @@ -169,7 +169,7 @@ away). .. code-block:: console - $ python -m websockets wss://websockets-echo.fly.dev/ + $ websockets wss://websockets-echo.fly.dev/ Connected to wss://websockets-echo.fly.dev/. Connection closed: 1001 (going away). diff --git a/docs/deploy/haproxy.rst b/docs/deploy/haproxy.rst index 5ffe21ea3..c30eaac57 100644 --- a/docs/deploy/haproxy.rst +++ b/docs/deploy/haproxy.rst @@ -54,7 +54,7 @@ You can confirm that HAProxy proxies connections properly: .. code-block:: console - $ PYTHONPATH=src python -m websockets ws://localhost:8080/ + $ PYTHONPATH=src websockets ws://localhost:8080/ Connected to ws://localhost:8080/. > Hello! < Hello! diff --git a/docs/deploy/heroku.rst b/docs/deploy/heroku.rst index 8d16eccfb..7b6ca58df 100644 --- a/docs/deploy/heroku.rst +++ b/docs/deploy/heroku.rst @@ -134,7 +134,7 @@ name of your Heroku app in this command: .. code-block:: console - $ python -m websockets wss://websockets-echo.herokuapp.com/ + $ websockets wss://websockets-echo.herokuapp.com/ Connected to wss://websockets-echo.herokuapp.com/. > @@ -156,7 +156,7 @@ with your app: .. code-block:: console - $ python -m websockets wss://websockets-echo.herokuapp.com/ + $ websockets wss://websockets-echo.herokuapp.com/ Connected to wss://websockets-echo.herokuapp.com/. > @@ -173,7 +173,7 @@ away). .. code-block:: console - $ python -m websockets wss://websockets-echo.herokuapp.com/ + $ websockets wss://websockets-echo.herokuapp.com/ Connected to wss://websockets-echo.herokuapp.com/. Connection closed: 1001 (going away). diff --git a/docs/deploy/koyeb.rst b/docs/deploy/koyeb.rst index 0b7c96cb9..2f3342aa5 100644 --- a/docs/deploy/koyeb.rst +++ b/docs/deploy/koyeb.rst @@ -124,7 +124,7 @@ interactive client — you must replace ``https`` with ``wss`` in the URL: .. code-block:: console - $ python -m websockets wss://--.koyeb.app/ + $ websockets wss://--.koyeb.app/ Connected to wss://--.koyeb.app/. > @@ -145,7 +145,7 @@ Connect an interactive client again: .. code-block:: console - $ python -m websockets wss://--.koyeb.app/ + $ websockets wss://--.koyeb.app/ Connected to wss://--.koyeb.app/. > @@ -156,7 +156,7 @@ Eventually, the connection gets closed with code 1001 (going away). .. code-block:: console - $ python -m websockets wss://--.koyeb.app/ + $ websockets wss://--.koyeb.app/ Connected to wss://--.koyeb.app/. Connection closed: 1001 (going away). diff --git a/docs/deploy/kubernetes.rst b/docs/deploy/kubernetes.rst index 064a6ac4d..a4e7ad347 100644 --- a/docs/deploy/kubernetes.rst +++ b/docs/deploy/kubernetes.rst @@ -54,7 +54,7 @@ to the app and check that it echoes anything you send: .. code-block:: console - $ python -m websockets ws://localhost:32080/ + $ websockets ws://localhost:32080/ Connected to ws://localhost:32080/. > Hey there! < Hey there! @@ -71,7 +71,7 @@ shut down gracefully: .. code-block:: console - $ python -m websockets ws://localhost:32080/ + $ websockets ws://localhost:32080/ Connected to ws://localhost:32080/. > Hey there! < Hey there! @@ -119,7 +119,7 @@ You can connect to the service — press Ctrl-D to exit: .. code-block:: console - $ python -m websockets ws://localhost:32080/ + $ websockets ws://localhost:32080/ Connected to ws://localhost:32080/. Connection closed: 1000 (OK). diff --git a/docs/deploy/nginx.rst b/docs/deploy/nginx.rst index 5b37c9b36..60e0eb963 100644 --- a/docs/deploy/nginx.rst +++ b/docs/deploy/nginx.rst @@ -77,7 +77,7 @@ You can confirm that nginx proxies connections properly: .. code-block:: console - $ PYTHONPATH=src python -m websockets ws://localhost:8080/ + $ PYTHONPATH=src websockets ws://localhost:8080/ Connected to ws://localhost:8080/. > Hello! < Hello! diff --git a/docs/deploy/render.rst b/docs/deploy/render.rst index 70bf8c376..841dccaa4 100644 --- a/docs/deploy/render.rst +++ b/docs/deploy/render.rst @@ -129,7 +129,7 @@ name of your Render app in this command: .. code-block:: console - $ python -m websockets wss://websockets-echo.onrender.com/ + $ websockets wss://websockets-echo.onrender.com/ Connected to wss://websockets-echo.onrender.com/. > @@ -153,7 +153,7 @@ with your app: .. code-block:: console - $ python -m websockets wss://websockets-echo.onrender.com/ + $ websockets wss://websockets-echo.onrender.com/ Connected to wss://websockets-echo.onrender.com/. > @@ -162,7 +162,7 @@ deployment completes, the connection is closed with code 1001 (going away). .. code-block:: console - $ python -m websockets wss://websockets-echo.onrender.com/ + $ websockets wss://websockets-echo.onrender.com/ Connected to wss://websockets-echo.onrender.com/. Connection closed: 1001 (going away). diff --git a/docs/deploy/supervisor.rst b/docs/deploy/supervisor.rst index 5eefc7711..25a1b1ef5 100644 --- a/docs/deploy/supervisor.rst +++ b/docs/deploy/supervisor.rst @@ -64,7 +64,7 @@ press Ctrl-D to exit: .. code-block:: console - $ python -m websockets ws://localhost:8080/ + $ websockets ws://localhost:8080/ Connected to ws://localhost:8080/. > Hello! < Hello! @@ -89,7 +89,7 @@ establish a connection and leave it open: .. code-block:: console - $ python -m websockets ws://localhost:8080/ + $ websockets ws://localhost:8080/ Connected to ws://localhost:8080/. > @@ -115,7 +115,7 @@ And you can see that the connection to the app was closed gracefully: .. code-block:: console - $ python -m websockets ws://localhost:8080/ + $ websockets ws://localhost:8080/ Connected to ws://localhost:8080/. Connection closed: 1001 (going away). @@ -128,4 +128,3 @@ In a real deployment, you would likely: * Create a virtualenv dedicated to your application. * Add ``environment=PATH="path/to/your/virtualenv/bin"`` in the Supervisor configuration. Then ``python app.py`` runs in that virtualenv. - diff --git a/docs/howto/django.rst b/docs/howto/django.rst index 2fa0b89fd..556f626d1 100644 --- a/docs/howto/django.rst +++ b/docs/howto/django.rst @@ -144,7 +144,7 @@ prompt: .. code-block:: console - $ python -m websockets ws://localhost:8888/ + $ websockets ws://localhost:8888/ Connected to ws://localhost:8888/ > < Hello ! @@ -157,7 +157,7 @@ closes the connection: .. code-block:: console - $ python -m websockets ws://localhost:8888/ + $ websockets ws://localhost:8888/ Connected to ws://localhost:8888. > not a token Connection closed: 1011 (internal error) authentication failed. diff --git a/docs/index.rst b/docs/index.rst index bc3cc9df4..738258688 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -87,7 +87,7 @@ Also, websockets provides an interactive client: .. code-block:: console - $ python -m websockets ws://localhost:8765/ + $ websockets ws://localhost:8765/ Connected to ws://localhost:8765/. > Hello world! < Hello world! diff --git a/docs/intro/tutorial1.rst b/docs/intro/tutorial1.rst index 39e693aae..7a0673db7 100644 --- a/docs/intro/tutorial1.rst +++ b/docs/intro/tutorial1.rst @@ -53,7 +53,7 @@ Confirm that websockets is installed: .. code-block:: console - $ python -m websockets --version + $ websockets --version .. admonition:: This tutorial is written for websockets |release|. :class: tip @@ -239,7 +239,7 @@ Open another shell and run this command: .. code-block:: console - $ python -m websockets ws://localhost:8001/ + $ websockets ws://localhost:8001/ You get a prompt. Type a message and press "Enter". Switch to the shell where the server is running and check that the server received the message. Good! diff --git a/docs/intro/tutorial3.rst b/docs/intro/tutorial3.rst index bdd1bd50b..eee185388 100644 --- a/docs/intro/tutorial3.rst +++ b/docs/intro/tutorial3.rst @@ -187,7 +187,7 @@ of your app in the format: ``https://--.koyeb.app/``. Replace .. code-block:: console - $ python -m websockets wss://--.koyeb.app/ + $ websockets wss://--.koyeb.app/ Connected to wss://--.koyeb.app/. > {"type": "init"} < {"type": "init", "join": "54ICxFae_Ip7TJE2", "watch": "634w44TblL5Dbd9a"} diff --git a/src/websockets/__main__.py b/src/websockets/__main__.py index 5043e1e29..43d70a8d8 100644 --- a/src/websockets/__main__.py +++ b/src/websockets/__main__.py @@ -135,7 +135,7 @@ async def interactive_client(uri: str) -> None: def main() -> None: parser = argparse.ArgumentParser( - prog="python -m websockets", + prog="websockets", description="Interactive WebSocket client.", add_help=False, )