From bef42d97d16a89c5f39bd36d62641c458d9a0f7f Mon Sep 17 00:00:00 2001 From: Tobias Oberstein Date: Sat, 19 Dec 2020 23:36:05 +0100 Subject: [PATCH] sync (#1441) * update and fix CI/CD * bump release --- .github/workflows/main.yml | 40 ++++-- README.rst | 35 +++--- autobahn/_version.py | 2 +- ...cio_rawsocket.py => test_aio_rawsocket.py} | 0 ...cio_websocket.py => test_aio_websocket.py} | 0 autobahn/asyncio/wamp.py | 4 +- ...validator.py => test_nvx_utf8validator.py} | 0 autobahn/rawsocket/test/__init__.py | 25 ---- autobahn/{test/__init__.py => testutil.py} | 0 autobahn/twisted/test/__init__.py | 25 ---- ...unner.py => test_tx_application_runner.py} | 0 ...osereactor.py => test_tx_choosereactor.py} | 0 ...test_component.py => test_tx_component.py} | 2 +- ...plugins.py => test_tx_endpoint_plugins.py} | 0 .../{test_protocol.py => test_tx_protocol.py} | 4 +- ...test_rawsocket.py => test_tx_rawsocket.py} | 2 +- ...et_agent.py => test_tx_websocket_agent.py} | 0 autobahn/wamp/component.py | 10 +- autobahn/wamp/protocol.py | 4 +- autobahn/wamp/test/__init__.py | 25 ---- .../test/{test_auth.py => test_wamp_auth.py} | 0 ...st_component.py => test_wamp_component.py} | 0 ...nent_aio.py => test_wamp_component_aio.py} | 0 ...st_cryptobox.py => test_wamp_cryptobox.py} | 0 ..._cryptosign.py => test_wamp_cryptosign.py} | 0 ...st_exception.py => test_wamp_exception.py} | 0 .../{test_message.py => test_wamp_message.py} | 0 ...test_protocol.py => test_wamp_protocol.py} | 0 ...col_peer.py => test_wamp_protocol_peer.py} | 0 .../{test_runner.py => test_wamp_runner.py} | 0 ..._serializer.py => test_wamp_serializer.py} | 0 ...ri_pattern.py => test_wamp_uri_pattern.py} | 0 ...rs.py => test_wamp_user_handler_errors.py} | 0 ...st_websocket.py => test_wamp_websocket.py} | 0 autobahn/websocket/test/__init__.py | 25 ---- ...t_websocket.py => test_websocket_frame.py} | 2 +- ...protocol.py => test_websocket_protocol.py} | 2 +- autobahn/xbr/test/__init__.py | 0 ...{test_mnemonic.py => test_xbr_mnemonic.py} | 0 docs/asynchronous-programming.rst | 4 +- docs/changelog.rst | 11 +- docs/conf.py | 6 +- docs/reference/autobahn.wamp.component.rst | 2 +- pytest.ini | 9 ++ requirements-dev.txt | 2 + setup.py | 6 +- tox.ini | 115 ++++++++++++------ 47 files changed, 167 insertions(+), 195 deletions(-) rename autobahn/asyncio/test/{test_asyncio_rawsocket.py => test_aio_rawsocket.py} (100%) rename autobahn/asyncio/test/{test_asyncio_websocket.py => test_aio_websocket.py} (100%) rename autobahn/nvx/test/{test_utf8validator.py => test_nvx_utf8validator.py} (100%) delete mode 100644 autobahn/rawsocket/test/__init__.py rename autobahn/{test/__init__.py => testutil.py} (100%) delete mode 100644 autobahn/twisted/test/__init__.py rename autobahn/twisted/test/{test_application_runner.py => test_tx_application_runner.py} (100%) rename autobahn/twisted/test/{test_choosereactor.py => test_tx_choosereactor.py} (100%) rename autobahn/twisted/test/{test_component.py => test_tx_component.py} (99%) rename autobahn/twisted/test/{test_endpoint_plugins.py => test_tx_endpoint_plugins.py} (100%) rename autobahn/twisted/test/{test_protocol.py => test_tx_protocol.py} (99%) rename autobahn/twisted/test/{test_rawsocket.py => test_tx_rawsocket.py} (98%) rename autobahn/twisted/test/{test_websocket_agent.py => test_tx_websocket_agent.py} (100%) delete mode 100644 autobahn/wamp/test/__init__.py rename autobahn/wamp/test/{test_auth.py => test_wamp_auth.py} (100%) rename autobahn/wamp/test/{test_component.py => test_wamp_component.py} (100%) rename autobahn/wamp/test/{test_component_aio.py => test_wamp_component_aio.py} (100%) rename autobahn/wamp/test/{test_cryptobox.py => test_wamp_cryptobox.py} (100%) rename autobahn/wamp/test/{test_cryptosign.py => test_wamp_cryptosign.py} (100%) rename autobahn/wamp/test/{test_exception.py => test_wamp_exception.py} (100%) rename autobahn/wamp/test/{test_message.py => test_wamp_message.py} (100%) rename autobahn/wamp/test/{test_protocol.py => test_wamp_protocol.py} (100%) rename autobahn/wamp/test/{test_protocol_peer.py => test_wamp_protocol_peer.py} (100%) rename autobahn/wamp/test/{test_runner.py => test_wamp_runner.py} (100%) rename autobahn/wamp/test/{test_serializer.py => test_wamp_serializer.py} (100%) rename autobahn/wamp/test/{test_uri_pattern.py => test_wamp_uri_pattern.py} (100%) rename autobahn/wamp/test/{test_user_handler_errors.py => test_wamp_user_handler_errors.py} (100%) rename autobahn/wamp/test/{test_websocket.py => test_wamp_websocket.py} (100%) delete mode 100644 autobahn/websocket/test/__init__.py rename autobahn/websocket/test/{test_websocket.py => test_websocket_frame.py} (99%) rename autobahn/websocket/test/{test_protocol.py => test_websocket_protocol.py} (99%) delete mode 100644 autobahn/xbr/test/__init__.py rename autobahn/xbr/test/{test_mnemonic.py => test_xbr_mnemonic.py} (100%) create mode 100644 pytest.ini diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 77b7c4da0..d8c35c996 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,7 +18,7 @@ on: jobs: check: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -44,9 +44,10 @@ jobs: # since we use --parallel-mode to coverage inside Tox we use # "coverage combine" so the filename is always ".coverage" - name: Run Coverage + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} run: | tox -c tox.ini -e coverage - coverage combine && codecov test: env: @@ -56,11 +57,14 @@ jobs: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest] - # os: [ubuntu-latest, macos-latest, windows-latest] + os: [ubuntu-20.04] + # os: [ubuntu-20.04, macos-latest, windows-latest] # https://github.com/actions/setup-python#specifying-a-pypy-version - python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7'] + # python-version: ['3.6', '3.7', '3.8', '3.9', 'pypy-3.6', 'pypy-3.7'] + # framework: ['asyncio', 'tw189', 'tw1910', 'tw203', 'twtrunk'] + python-version: ['3.6', '3.9', 'pypy-3.7'] + framework: ['asyncio', 'tw203', 'twtrunk'] # https://github.blog/changelog/2020-04-15-github-actions-new-workflow-features/ # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions#jobsjob_idstepscontinue-on-error @@ -71,9 +75,11 @@ jobs: - uses: actions/checkout@v2 # Install OS packages, as we install Python packages from source: - # libenchant-dev: needed for pyenchant, needed for sphinx-spellcheck - # libbz2-dev, libsnappy-dev: needed for compression - # libunwind-dev: needed for vmprof + # + # libenchant-dev needed for pyenchant, needed for sphinx-spellcheck + # libbz2-dev, libsnappy-dev needed for compression + # libunwind-dev needed for vmprof + # - name: Install OS package dependencies run: | sudo apt update @@ -95,14 +101,18 @@ jobs: - name: Install this package run: | - pip install . + make abi_files + pip install .[all] - name: Run unit tests (PyTest) run: | - tox -c tox.ini + python -c "import autobahn; print(autobahn.__version__)" + python -c "from autobahn import xbr; print(xbr.HAS_XBR)" + python -c "from autobahn.testutil import FakeTransport; print(FakeTransport)" + tox -c tox.ini -e ${{ matrix.framework }} docs: - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -122,6 +132,11 @@ jobs: python -m pip install --upgrade pip pip install -r requirements-dev.txt + - name: Install this package + run: | + make abi_files + pip install .[all] + - name: Run Sphinx run: tox -c tox.ini -e sphinx @@ -139,7 +154,7 @@ jobs: AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} WAMP_PRIVATE_KEY: ${{ secrets.WAMP_PRIVATE_KEY }} - runs-on: ubuntu-latest + runs-on: ubuntu-20.04 steps: - uses: actions/checkout@v2 @@ -147,7 +162,6 @@ jobs: # https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-commands-for-github-actions#adding-a-system-path - name: Set environment run: | - echo "${HOME}/.local/bin" >> $GITHUB_PATH echo BUILD_DATE=`date -u +"%Y-%m-%d"` >> $GITHUB_ENV echo AUTOBAHN_VCS_REF=`git rev-parse --short ${GITHUB_SHA}` >> $GITHUB_ENV echo AUTOBAHN_BUILD_ID=$(date --utc +%Y%m%d)-$(git rev-parse --short ${GITHUB_SHA}) >> $GITHUB_ENV diff --git a/README.rst b/README.rst index 8d944e6a4..6faad8527 100644 --- a/README.rst +++ b/README.rst @@ -8,25 +8,25 @@ WebSocket & WAMP for Python on Twisted and asyncio. -------------- | **Quick Links**: `Source Code `__ - `Documentation `__ - `WebSocket Examples `__ - `WAMP Examples `__ -| **Community**: `Mailing list `__ - `StackOverflow `__ - `Twitter `__ - `IRC #autobahn/chat.freenode.net `__ -| **Companion Projects**: `Autobahn|JS `__ - `Autobahn|Cpp `__ - `Autobahn|Testsuite `__ - `Crossbar.io `__ - `WAMP `__ +| **Community**: `Forum `__ - `StackOverflow `__ - `Twitter `__ - `IRC #autobahn/chat.freenode.net `__ +| **Companion Projects**: `Autobahn|JS `__ - `Autobahn|Cpp `__ - `Autobahn|Testsuite `__ - `Crossbar.io `__ - `WAMP `__ Introduction ------------ -**Autobahn\|Python** is a subproject of `Autobahn `__ and provides open-source +**Autobahn\|Python** is a subproject of `Autobahn `__ and provides open-source implementations of -- `The WebSocket Protocol `__ -- `The Web Application Messaging Protocol (WAMP) `__ +- `The WebSocket Protocol `__ +- `The Web Application Messaging Protocol (WAMP) `__ -for Python 3.6+ and running on `Twisted `__ and `asyncio `__. +for Python 3.6+ and running on `Twisted `__ and `asyncio `__. You can use **Autobahn\|Python** to create clients and servers in Python speaking just plain WebSocket or WAMP. -**WebSocket** allows `bidirectional real-time messaging on the Web `__ and beyond, while `WAMP `__ adds real-time application communication on top of WebSocket. +**WebSocket** allows `bidirectional real-time messaging on the Web `__ and beyond, while `WAMP `__ adds real-time application communication on top of WebSocket. -**WAMP** provides asynchronous **Remote Procedure Calls** and **Publish & Subscribe** for applications in *one* protocol running over `WebSocket `__. WAMP is a *routed* protocol, so you need a **WAMP Router** to connect your **Autobahn\|Python** based clients. We provide `Crossbar.io `__, but there are `other options `__ as well. +**WAMP** provides asynchronous **Remote Procedure Calls** and **Publish & Subscribe** for applications in *one* protocol running over `WebSocket `__. WAMP is a *routed* protocol, so you need a **WAMP Router** to connect your **Autobahn\|Python** based clients. We provide `Crossbar.io `__, but there are `other options `__ as well. .. note:: @@ -35,14 +35,14 @@ You can use **Autobahn\|Python** to create clients and servers in Python speakin Features -------- -- framework for `WebSocket `__ and `WAMP `__ clients and servers -- runs on `CPython `__, `PyPy `__ and `Jython `__ -- runs under `Twisted `__ and `asyncio `__ - implements WebSocket - `RFC6455 `__ and Draft Hybi-10+ -- implements `WebSocket compression `__ -- implements `WAMP `__, the Web Application Messaging Protocol +- framework for `WebSocket `__ and `WAMP `__ clients and servers +- runs on `CPython `__ and `PyPy ` +- runs under `Twisted `__ and `asyncio `__ - implements WebSocket + `RFC6455 `__ and Draft Hybi-10+ +- implements `WebSocket compression `__ +- implements `WAMP `__, the Web Application Messaging Protocol - high-performance, fully asynchronous implementation -- best-in-class standards conformance (100% strict passes with `Autobahn Testsuite `__: `Client `__ `Server `__) +- best-in-class standards conformance (100% strict passes with `Autobahn Testsuite `__: `Client `__ `Server `__) - message-, frame- and streaming-APIs for WebSocket - supports TLS (secure WebSocket) and proxies - Open-source (`MIT license `__) @@ -268,8 +268,9 @@ implementation, set the environment variable: .. |Master Branch| image:: https://img.shields.io/badge/branch-master-orange.svg :target: https://travis-ci.com/crossbario/autobahn-python.svg?branch=master -.. |Build Status| image:: https://travis-ci.com/crossbario/autobahn-python.svg?branch=master - :target: https://travis-ci.com/crossbario/autobahn-python +.. |Build Status| image:: https://github.com/crossbario/autobahn-python/workflows/main/badge.svg + :target: https://github.com/crossbario/autobahn-python/actions?query=workflow%3Amain + :alt: Build Status .. |Coverage| image:: https://img.shields.io/codecov/c/github/crossbario/autobahn-python/master.svg :target: https://codecov.io/github/crossbario/autobahn-python diff --git a/autobahn/_version.py b/autobahn/_version.py index df0380770..ab035c853 100644 --- a/autobahn/_version.py +++ b/autobahn/_version.py @@ -24,4 +24,4 @@ # ############################################################################### -__version__ = '20.12.2' +__version__ = '20.12.3' diff --git a/autobahn/asyncio/test/test_asyncio_rawsocket.py b/autobahn/asyncio/test/test_aio_rawsocket.py similarity index 100% rename from autobahn/asyncio/test/test_asyncio_rawsocket.py rename to autobahn/asyncio/test/test_aio_rawsocket.py diff --git a/autobahn/asyncio/test/test_asyncio_websocket.py b/autobahn/asyncio/test/test_aio_websocket.py similarity index 100% rename from autobahn/asyncio/test/test_asyncio_websocket.py rename to autobahn/asyncio/test/test_aio_websocket.py diff --git a/autobahn/asyncio/wamp.py b/autobahn/asyncio/wamp.py index 9ce1291d9..7b11e3c70 100644 --- a/autobahn/asyncio/wamp.py +++ b/autobahn/asyncio/wamp.py @@ -57,8 +57,8 @@ class ApplicationSession(protocol.ApplicationSession): Implements: - * :class:`autobahn.wamp.interfaces.ITransportHandler` - * :class:`autobahn.wamp.interfaces.ISession` + * ``autobahn.wamp.interfaces.ITransportHandler`` + * ``autobahn.wamp.interfaces.ISession`` """ log = txaio.make_logger() diff --git a/autobahn/nvx/test/test_utf8validator.py b/autobahn/nvx/test/test_nvx_utf8validator.py similarity index 100% rename from autobahn/nvx/test/test_utf8validator.py rename to autobahn/nvx/test/test_nvx_utf8validator.py diff --git a/autobahn/rawsocket/test/__init__.py b/autobahn/rawsocket/test/__init__.py deleted file mode 100644 index 89caae255..000000000 --- a/autobahn/rawsocket/test/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# -# The MIT License (MIT) -# -# Copyright (c) Crossbar.io Technologies GmbH -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -############################################################################### diff --git a/autobahn/test/__init__.py b/autobahn/testutil.py similarity index 100% rename from autobahn/test/__init__.py rename to autobahn/testutil.py diff --git a/autobahn/twisted/test/__init__.py b/autobahn/twisted/test/__init__.py deleted file mode 100644 index 89caae255..000000000 --- a/autobahn/twisted/test/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# -# The MIT License (MIT) -# -# Copyright (c) Crossbar.io Technologies GmbH -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -############################################################################### diff --git a/autobahn/twisted/test/test_application_runner.py b/autobahn/twisted/test/test_tx_application_runner.py similarity index 100% rename from autobahn/twisted/test/test_application_runner.py rename to autobahn/twisted/test/test_tx_application_runner.py diff --git a/autobahn/twisted/test/test_choosereactor.py b/autobahn/twisted/test/test_tx_choosereactor.py similarity index 100% rename from autobahn/twisted/test/test_choosereactor.py rename to autobahn/twisted/test/test_tx_choosereactor.py diff --git a/autobahn/twisted/test/test_component.py b/autobahn/twisted/test/test_tx_component.py similarity index 99% rename from autobahn/twisted/test/test_component.py rename to autobahn/twisted/test/test_tx_component.py index a539ce006..2f1afede2 100644 --- a/autobahn/twisted/test/test_component.py +++ b/autobahn/twisted/test/test_tx_component.py @@ -32,7 +32,7 @@ from zope.interface import directlyProvides from autobahn.wamp.message import Welcome, Goodbye, Hello, Abort from autobahn.wamp.serializer import JsonSerializer - from autobahn.test import FakeTransport + from autobahn.testutil import FakeTransport from twisted.internet.interfaces import IStreamClientEndpoint from twisted.internet.defer import inlineCallbacks, succeed, Deferred from twisted.internet.task import Clock diff --git a/autobahn/twisted/test/test_endpoint_plugins.py b/autobahn/twisted/test/test_tx_endpoint_plugins.py similarity index 100% rename from autobahn/twisted/test/test_endpoint_plugins.py rename to autobahn/twisted/test/test_tx_endpoint_plugins.py diff --git a/autobahn/twisted/test/test_protocol.py b/autobahn/twisted/test/test_tx_protocol.py similarity index 99% rename from autobahn/twisted/test/test_protocol.py rename to autobahn/twisted/test/test_tx_protocol.py index 2326c2271..0c24d1824 100644 --- a/autobahn/twisted/test/test_protocol.py +++ b/autobahn/twisted/test/test_tx_protocol.py @@ -40,7 +40,7 @@ from twisted.internet.testing import StringTransport except ImportError: from twisted.test.proto_helpers import StringTransport -from autobahn.test import FakeTransport +from autobahn.testutil import FakeTransport class ExceptionHandlingTests(unittest.TestCase): @@ -386,7 +386,7 @@ class TestProto(WebSocketClientProtocol): def onConnecting(self, transport_details): raise RuntimeError("bad stuff") - from autobahn.test import FakeTransport + from autobahn.testutil import FakeTransport proto = TestProto() proto.transport = FakeTransport() d = proto.startHandshake() diff --git a/autobahn/twisted/test/test_rawsocket.py b/autobahn/twisted/test/test_tx_rawsocket.py similarity index 98% rename from autobahn/twisted/test/test_rawsocket.py rename to autobahn/twisted/test/test_tx_rawsocket.py index 7438fe68c..d841d6a19 100644 --- a/autobahn/twisted/test/test_rawsocket.py +++ b/autobahn/twisted/test/test_tx_rawsocket.py @@ -31,7 +31,7 @@ WampRawSocketServerProtocol, WampRawSocketClientFactory, WampRawSocketClientProtocol) -from autobahn.test import FakeTransport +from autobahn.testutil import FakeTransport class RawSocketHandshakeTests(unittest.TestCase): diff --git a/autobahn/twisted/test/test_websocket_agent.py b/autobahn/twisted/test/test_tx_websocket_agent.py similarity index 100% rename from autobahn/twisted/test/test_websocket_agent.py rename to autobahn/twisted/test/test_tx_websocket_agent.py diff --git a/autobahn/wamp/component.py b/autobahn/wamp/component.py index d33801f57..88b015b17 100644 --- a/autobahn/wamp/component.py +++ b/autobahn/wamp/component.py @@ -417,7 +417,7 @@ def __init__(self, main=None, transports=None, config=None, realm='realm1', extr pass a main() procedure, the session will not be closed (unless you arrange for .leave() to be called). - :type main: callable taking 2 args: reactor, ISession + :type main: callable taking two args ``reactor`` and ``ISession`` :param transports: Transport configurations for creating transports. Each transport can be a WAMP URL, or a dict @@ -445,25 +445,23 @@ def __init__(self, main=None, transports=None, config=None, realm='realm1', extr - ``options``: tbd - ``proxy``: tbd - :type transports: None or unicode or list of dicts + :type transports: None or str or list :param realm: the realm to join - :type realm: unicode + :type realm: str :param authentication: configuration of authenticators - :type authentication: dict mapping auth_type to dict + :type authentication: dict :param session_factory: if None, ``ApplicationSession`` is used, otherwise a callable taking a single ``config`` argument that is used to create a new `ApplicationSession` instance. - :type session_factory: callable :param is_fatal: a callable taking a single argument, an ``Exception`` instance. The callable should return ``True`` if this error is "fatal", meaning we should not try connecting to the current transport again. The default behavior (on None) is to always return ``False`` - :type is_fatal: callable taking one arg, or None """ self.set_valid_events( [ diff --git a/autobahn/wamp/protocol.py b/autobahn/wamp/protocol.py index ca055c433..5edf7a688 100644 --- a/autobahn/wamp/protocol.py +++ b/autobahn/wamp/protocol.py @@ -1775,8 +1775,8 @@ class _SessionShim(ApplicationSession): ApplicationSession "directly". **NOTE:** this is not public or intended for use; you should import - either :class:`autobahn.asyncio.wamp.Session` or - :class:`autobahn.twisted.wamp.Session` depending on which async + either autobahn.asyncio.wamp.Session or + autobahn.twisted.wamp.Session depending on which async framework yo're using. """ diff --git a/autobahn/wamp/test/__init__.py b/autobahn/wamp/test/__init__.py deleted file mode 100644 index 89caae255..000000000 --- a/autobahn/wamp/test/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# -# The MIT License (MIT) -# -# Copyright (c) Crossbar.io Technologies GmbH -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -############################################################################### diff --git a/autobahn/wamp/test/test_auth.py b/autobahn/wamp/test/test_wamp_auth.py similarity index 100% rename from autobahn/wamp/test/test_auth.py rename to autobahn/wamp/test/test_wamp_auth.py diff --git a/autobahn/wamp/test/test_component.py b/autobahn/wamp/test/test_wamp_component.py similarity index 100% rename from autobahn/wamp/test/test_component.py rename to autobahn/wamp/test/test_wamp_component.py diff --git a/autobahn/wamp/test/test_component_aio.py b/autobahn/wamp/test/test_wamp_component_aio.py similarity index 100% rename from autobahn/wamp/test/test_component_aio.py rename to autobahn/wamp/test/test_wamp_component_aio.py diff --git a/autobahn/wamp/test/test_cryptobox.py b/autobahn/wamp/test/test_wamp_cryptobox.py similarity index 100% rename from autobahn/wamp/test/test_cryptobox.py rename to autobahn/wamp/test/test_wamp_cryptobox.py diff --git a/autobahn/wamp/test/test_cryptosign.py b/autobahn/wamp/test/test_wamp_cryptosign.py similarity index 100% rename from autobahn/wamp/test/test_cryptosign.py rename to autobahn/wamp/test/test_wamp_cryptosign.py diff --git a/autobahn/wamp/test/test_exception.py b/autobahn/wamp/test/test_wamp_exception.py similarity index 100% rename from autobahn/wamp/test/test_exception.py rename to autobahn/wamp/test/test_wamp_exception.py diff --git a/autobahn/wamp/test/test_message.py b/autobahn/wamp/test/test_wamp_message.py similarity index 100% rename from autobahn/wamp/test/test_message.py rename to autobahn/wamp/test/test_wamp_message.py diff --git a/autobahn/wamp/test/test_protocol.py b/autobahn/wamp/test/test_wamp_protocol.py similarity index 100% rename from autobahn/wamp/test/test_protocol.py rename to autobahn/wamp/test/test_wamp_protocol.py diff --git a/autobahn/wamp/test/test_protocol_peer.py b/autobahn/wamp/test/test_wamp_protocol_peer.py similarity index 100% rename from autobahn/wamp/test/test_protocol_peer.py rename to autobahn/wamp/test/test_wamp_protocol_peer.py diff --git a/autobahn/wamp/test/test_runner.py b/autobahn/wamp/test/test_wamp_runner.py similarity index 100% rename from autobahn/wamp/test/test_runner.py rename to autobahn/wamp/test/test_wamp_runner.py diff --git a/autobahn/wamp/test/test_serializer.py b/autobahn/wamp/test/test_wamp_serializer.py similarity index 100% rename from autobahn/wamp/test/test_serializer.py rename to autobahn/wamp/test/test_wamp_serializer.py diff --git a/autobahn/wamp/test/test_uri_pattern.py b/autobahn/wamp/test/test_wamp_uri_pattern.py similarity index 100% rename from autobahn/wamp/test/test_uri_pattern.py rename to autobahn/wamp/test/test_wamp_uri_pattern.py diff --git a/autobahn/wamp/test/test_user_handler_errors.py b/autobahn/wamp/test/test_wamp_user_handler_errors.py similarity index 100% rename from autobahn/wamp/test/test_user_handler_errors.py rename to autobahn/wamp/test/test_wamp_user_handler_errors.py diff --git a/autobahn/wamp/test/test_websocket.py b/autobahn/wamp/test/test_wamp_websocket.py similarity index 100% rename from autobahn/wamp/test/test_websocket.py rename to autobahn/wamp/test/test_wamp_websocket.py diff --git a/autobahn/websocket/test/__init__.py b/autobahn/websocket/test/__init__.py deleted file mode 100644 index 89caae255..000000000 --- a/autobahn/websocket/test/__init__.py +++ /dev/null @@ -1,25 +0,0 @@ -############################################################################### -# -# The MIT License (MIT) -# -# Copyright (c) Crossbar.io Technologies GmbH -# -# Permission is hereby granted, free of charge, to any person obtaining a copy -# of this software and associated documentation files (the "Software"), to deal -# in the Software without restriction, including without limitation the rights -# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -# copies of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in -# all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -# THE SOFTWARE. -# -############################################################################### diff --git a/autobahn/websocket/test/test_websocket.py b/autobahn/websocket/test/test_websocket_frame.py similarity index 99% rename from autobahn/websocket/test/test_websocket.py rename to autobahn/websocket/test/test_websocket_frame.py index ee5d23981..222d972a9 100644 --- a/autobahn/websocket/test/test_websocket.py +++ b/autobahn/websocket/test/test_websocket_frame.py @@ -37,7 +37,7 @@ from autobahn.twisted.websocket import WebSocketClientProtocol from autobahn.twisted.websocket import WebSocketClientFactory from autobahn.websocket.compress_deflate import PerMessageDeflate - from autobahn.test import FakeTransport + from autobahn.testutil import FakeTransport from unittest.mock import MagicMock, patch from txaio.testutil import replace_loop diff --git a/autobahn/websocket/test/test_protocol.py b/autobahn/websocket/test/test_websocket_protocol.py similarity index 99% rename from autobahn/websocket/test/test_protocol.py rename to autobahn/websocket/test/test_websocket_protocol.py index 48ba09a19..9ce7ed7ac 100644 --- a/autobahn/websocket/test/test_protocol.py +++ b/autobahn/websocket/test/test_websocket_protocol.py @@ -36,7 +36,7 @@ from autobahn.websocket.protocol import WebSocketClientFactory from autobahn.websocket.protocol import WebSocketProtocol from autobahn.websocket.types import ConnectingRequest -from autobahn.test import FakeTransport +from autobahn.testutil import FakeTransport import txaio diff --git a/autobahn/xbr/test/__init__.py b/autobahn/xbr/test/__init__.py deleted file mode 100644 index e69de29bb..000000000 diff --git a/autobahn/xbr/test/test_mnemonic.py b/autobahn/xbr/test/test_xbr_mnemonic.py similarity index 100% rename from autobahn/xbr/test/test_mnemonic.py rename to autobahn/xbr/test/test_xbr_mnemonic.py diff --git a/docs/asynchronous-programming.rst b/docs/asynchronous-programming.rst index 069bfa49f..f47262aad 100644 --- a/docs/asynchronous-programming.rst +++ b/docs/asynchronous-programming.rst @@ -267,14 +267,14 @@ Now, when converted to ``inlineCallbacks``, the code becomes: Have a look at the highlighted lines - here is what we do: 1. Decorating our squaring function with ``inlineCallbacks`` (line 5). Doing so marks the function as a coroutine which allows us to use this sequential looking coding style. -2. Inside the function, we simulate the slow execution by sleeping for a second (line 7). However, we are sleeping in a non-blocking way (:func:`autobahn.twisted.util.sleep`). The ``yield`` will put the coroutine aside until the sleep returns. +2. Inside the function, we simulate the slow execution by sleeping for a second (line 7). However, we are sleeping in a non-blocking way (``autobahn.twisted.util.sleep``). The ``yield`` will put the coroutine aside until the sleep returns. 3. To return values from Twisted coroutines, we need to use ``returnValue`` (line 8). .. note:: The reason ``returnValue`` is necessary goes deep into implementation details of Twisted and Python. In short: co-routines in Python 2 with Twisted are simulated using exceptions. Only Python 3.3+ has gotten native support for co-routines using the new yield from statement, Python 3.5+ use await statement and it is the new recommended method. -In above, we are using a little helper :func:`autobahn.twisted.util.sleep` for sleeping "inline". The helper is really trivial: +In above, we are using a little helper ``autobahn.twisted.util.sleep`` for sleeping "inline". The helper is really trivial: .. code-block:: python diff --git a/docs/changelog.rst b/docs/changelog.rst index 141855155..675511076 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -5,6 +5,13 @@ Changelog ========= +20.12.3 +------- + +* fix: URL must be re-encoded when doing redirect (#1439) +* fix: update and migrate CI/CD pipeline to GitHub Actions +* new: minimum supported Python (language) version is now 3.6 (on CPython and PyPy) + 20.12.2 ------- @@ -98,7 +105,7 @@ Changelog * fix: CI building (caching?) issue "corrupt ZIP file" * fix: update docker image build scripts and add ARM64/PyPy * fix: update XBR ABI files -* fix: use :func:`txaio.time_ns` and drop deprecated :func:`autobahn.util.time_ns` +* fix: use txaio.time_ns and drop deprecated autobahn.util.time_ns * fix: update project README and docs for supported python versions (#1296) * fix: WebSocket protocol instances now raise `autobahn.exception.Disconnected` when sending on a closed connection (#1002) * fix: version conflict in xbr downstream application dependency (crossbarfx) (#1295) @@ -120,7 +127,7 @@ Changelog * IMPORTANT: release v19.11.2 will be the last release supporting Python 2. We will support Python 3.5 and later beginning with Autobahn v20.1.1. * fix: add docs for parameters to component.py (#1276) * new: statistics tracking on WAMP serializers :class:`autobahn.wamp.serializer.Serializer` -* new: helper :func:`autobahn.util.time_ns` +* new: helper autobahn.util.time_ns 19.11.1 ------- diff --git a/docs/conf.py b/docs/conf.py index 0eec88dc2..c6548d1bd 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -307,8 +307,12 @@ def autodoc_skip_member(app, what, name, obj, skip, options): # http://sphinx-doc.org/ext/intersphinx.html intersphinx_mapping = { - 'py2': ('https://docs.python.org/2', None), 'py3': ('https://docs.python.org/3', None), + 'python': ('https://docs.python.org/3', None), + 'rtd': ('https://docs.readthedocs.io/en/latest/', None), + 'txaio': ('https://txaio.readthedocs.io/en/latest/', None), + 'autobahn': ('https://autobahn.readthedocs.io/en/latest/', None), + 'zlmdb': ('https://zlmdb.readthedocs.io/en/latest/', None), } rst_epilog = """ diff --git a/docs/reference/autobahn.wamp.component.rst b/docs/reference/autobahn.wamp.component.rst index 8e7b5da8d..4f857b7e0 100644 --- a/docs/reference/autobahn.wamp.component.rst +++ b/docs/reference/autobahn.wamp.component.rst @@ -4,7 +4,7 @@ Module ``autobahn.wamp.component`` Component --------- -This is common code for both Twisted and asyncio components; see either :class:`autobahn.twisted.component.Component` or :class:`autobahn.asyncio.component.Component` for the concrete implementations. +This is common code for both Twisted and asyncio components; see either ``autobahn.twisted.component.Component`` or ``autobahn.asyncio.component.Component`` for the concrete implementations. .. autoclass:: autobahn.wamp.component.Component :members: diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 000000000..09dc540b0 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,9 @@ +# https://docs.pytest.org/en/stable/reference.html#ini-options-ref + +[pytest] +minversion = 6.2 +addopts = -ra -q +testpaths = + test +python_files = + test_*.py diff --git a/requirements-dev.txt b/requirements-dev.txt index 98593c852..8f8e48fd9 100644 --- a/requirements-dev.txt +++ b/requirements-dev.txt @@ -1,3 +1,4 @@ +txaio>=20.4.1 pip>=9.0.1 bumpversion>=0.5.3 wheel>=0.30.0 @@ -7,6 +8,7 @@ tox>=2.9.1 tox-gh-actions>=2.2.0 codecov>=2.0.15 sphinx>=1.7.1 +sphinxcontrib-images>=0.9.1 twine>=1.10.0 pytest>=3.4.2 pytest-runner>=2.11.1 diff --git a/setup.py b/setup.py index c9a477c29..d9a340577 100644 --- a/setup.py +++ b/setup.py @@ -251,8 +251,9 @@ def run_tests(self): url='http://crossbar.io/autobahn', platforms='Any', install_requires=[ - 'txaio>=20.4.1', # MIT license - 'cryptography>=2.9.2', # BSD *or* Apache license + 'txaio>=20.4.1', # MIT license (https://github.com/crossbario/txaio) + 'cryptography>=2.9.2', # BSD *or* Apache license (https://github.com/pyca/cryptography) + 'hyperlink>=20.0.1', # MIT license (https://github.com/python-hyper/hyperlink) ], extras_require={ 'all': extras_require_all, @@ -299,7 +300,6 @@ def run_tests(self): "Programming Language :: Python :: 3.9", "Programming Language :: Python :: Implementation :: CPython", "Programming Language :: Python :: Implementation :: PyPy", - "Programming Language :: Python :: Implementation :: Jython", "Topic :: Internet", "Topic :: Internet :: WWW/HTTP", "Topic :: Communications", diff --git a/tox.ini b/tox.ini index ea8bd8ea4..8bfc41cf4 100644 --- a/tox.ini +++ b/tox.ini @@ -3,15 +3,17 @@ skip_missing_interpreters = true envlist = flake8 coverage + sphinx # CPython - py36-{tw189,tw1910,twtrunk,asyncio} - py37-{tw189,tw1910,twtrunk,asyncio} - py38-{tw189,tw1910,twtrunk,asyncio} - py39-{tw189,tw1910,twtrunk,asyncio} + py36-{tw189,tw1910,tw203,twtrunk,asyncio} + py37-{tw189,tw1910,tw203,twtrunk,asyncio} + py38-{tw189,tw1910,tw203,twtrunk,asyncio} + py39-{tw189,tw1910,tw203,twtrunk,asyncio} # PyPy - pypy37-{tw189,tw1910,twtrunk,asyncio} + pypy36-{tw189,tw1910,tw203,twtrunk,asyncio} + pypy37-{tw189,tw1910,tw203,twtrunk,asyncio} # MAP: GitHub Actions Python Name => Tox Env Name (for Python) @@ -42,9 +44,10 @@ deps = ; twisted dependencies tw189: twisted==18.9.0 tw1910: twisted==19.10.0 + tw203: twisted==20.3.0 # twtrunk: https://github.com/twisted/twisted/archive/trunk.zip twtrunk: git+https://github.com/twisted/twisted - {tw189,tw1910,twtrunk}: pytest-twisted + {tw189,tw1910,tw203,twtrunk}: pytest-twisted ; asyncio dependencies asyncio: pytest_asyncio @@ -54,22 +57,7 @@ extras = serialization scram nvx - -commands = - # download and extract archive with XBR ABI files into package directory for bundling - rm -f /tmp/xbr-protocol-latest.zip - curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip - unzip -t /tmp/xbr-protocol-latest.zip - rm -rf {toxinidir}/autobahn/xbr/contracts - unzip /tmp/xbr-protocol-latest.zip -d {toxinidir}/autobahn/xbr/contracts - - # install package - sh -c "which python && which pip && python -V" - pip install --no-cache --ignore-installed --force-reinstall .[twisted,asyncio,compress,serialization,encryption,scram] - - asyncio: {envbindir}/py.test -v {envsitepackagesdir}/autobahn - tw189,tw1910: {envbindir}/trial {envsitepackagesdir}/autobahn - twtrunk: python -m twisted.trial {envsitepackagesdir}/autobahn + xbr whitelist_externals = sh @@ -82,16 +70,22 @@ whitelist_externals = mv curl unzip + find setenv = - SODIUM_INSTALL = bundled - # env var for serializers - PYUBJSON_NO_EXTENSION = 1 - #AUTOBAHN_USE_NVX = 1 - #AUTOBAHN_USE_UJSON = 1 - #AUTOBAHN_USE_CBOR2 = 1 - asyncio: USE_ASYNCIO = 1 - tw189,tw1910,twtrunk: USE_TWISTED = 1 + # NaCl/Sodium: use and build bundled sources (don't use any system library) + SODIUM_INSTALL=bundled + + # controls build of WAMP serializers: + PYUBJSON_NO_EXTENSION=1 + # AUTOBAHN_USE_NVX=1 + # AUTOBAHN_USE_UJSON=1 + # AUTOBAHN_USE_CBOR2=1 + + # controls test setup according to networking framework + asyncio: USE_ASYNCIO=1 + asyncio: PYTHONPATH={toxinidir} + tw189,tw1910,tw203,twtrunk: USE_TWISTED=1 # this enables "autobahn/test/test_rng.py" (on Linux), # which tests entropy depletion, and tests how to correctly @@ -99,6 +93,23 @@ setenv = # also: https://github.com/crossbario/autobahn-python/issues/1275 # AUTOBAHN_CI_ENABLE_RNG_DEPLETION_TESTS = 1 +commands = + # download and extract archive with XBR ABI files into package directory for bundling + rm -f /tmp/xbr-protocol-latest.zip + curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip + unzip -t /tmp/xbr-protocol-latest.zip + rm -rf ./autobahn/xbr/contracts + unzip /tmp/xbr-protocol-latest.zip -d ./autobahn/xbr/contracts + + # install package + pip install -U pip + sh -c "which python && which pip && python -V" + pip install --no-cache --ignore-installed --force-reinstall .[twisted,asyncio,compress,serialization,encryption,scram,xbr] + + asyncio: pytest -v --ignore=./autobahn/twisted ./autobahn + tw189,tw1910,tw203: trial ./autobahn + twtrunk: python -m twisted.trial ./autobahn + [testenv:flake8] skip_install = True @@ -108,11 +119,10 @@ deps = exclude = autobahn/wamp/gen max-line-length = 119 commands = - sh -c "which python" python -V flake8 --version - ; These ignores will be removed when they are fixed and we are flake8-clean - flake8 --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815 \ + flake8 -v --statistics \ + --ignore=E402,E501,E722,E741,N801,N802,N803,N805,N806,N815 \ --exclude "autobahn/wamp/message_fbs.py,autobahn/wamp/gen/*" \ autobahn @@ -140,21 +150,48 @@ commands = rm -f /tmp/xbr-protocol-latest.zip curl -s https://xbr.network/lib/abi/xbr-protocol-latest.zip -o /tmp/xbr-protocol-latest.zip unzip -t /tmp/xbr-protocol-latest.zip - rm -rf {toxinidir}/autobahn/xbr/contracts - unzip /tmp/xbr-protocol-latest.zip -d {toxinidir}/autobahn/xbr/contracts + rm -rf ./autobahn/xbr/contracts + unzip /tmp/xbr-protocol-latest.zip -d ./autobahn/xbr/contracts # install package with all optional extensions pip install .[all] # test autobahn on asyncio (run under coverage) - sh -c 'USE_ASYNCIO=1 coverage run --parallel-mode --include "*/autobahn/asyncio/*" --omit "*/twisted/*" --omit "*/test/*.py" {envbindir}/py.test -v {envsitepackagesdir}/autobahn' + sh -c 'USE_ASYNCIO=1 coverage run --parallel-mode --include "*/autobahn/asyncio/*" --omit "*/twisted/*" --omit "*/test/*.py" -m pytest -v --ignore=./autobahn/twisted ./autobahn' # test autobahn on twisted (run under coverage) - sh -c 'USE_TWISTED=1 coverage run --parallel-mode --include "*/autobahn/*" --omit "*/asyncio/*" --omit "*/test/*.py" -m twisted.trial {envsitepackagesdir}/autobahn' - - twtrunk,asyncio: sh -c "mkdir -p {homedir}/coverage && cp {toxinidir}/.coverage.* {homedir}/coverage/ && ls -la {homedir}/coverage" + sh -c 'USE_TWISTED=1 coverage run --parallel-mode --include "*/autobahn/*" --omit "*/asyncio/*" --omit "*/test/*.py" -m twisted.trial ./autobahn' coverage combine coverage report coverage html codecov + + +[testenv:sphinx] +description = + Generate docs using Sphinx. +skip_install = False +deps = + sphinx + sphinx_rtd_theme + sphinxcontrib.images + git+https://github.com/crossbario/txaio +extras = + twisted + encryption + serialization + scram + nvx + xbr +commands = + python -V + sphinx-build --version + python -c "from autobahn import xbr; print('HAS_XBR={}'.format(xbr.HAS_XBR))" + + # first test with all warnings fatal + find ./docs -name "*.rst" + sphinx-build -WT -b dummy ./docs ./docs/_build + + # generate HTML output + sphinx-build -b html ./docs ./docs/_build