Metadata-Version: 2.4
Name: autobahn
Version: 25.12.2
Summary: WebSocket client & server library, WAMP real-time framework
Project-URL: Homepage, https://autobahn.readthedocs.io/
Project-URL: Source, https://github.com/crossbario/autobahn-python
Author-email: typedef int GmbH <contact@typedefint.eu>
License-Expression: MIT
License-File: LICENSE
Keywords: asyncio,autobahn,crossbar,pubsub,realtime,rfc6455,rpc,twisted,wamp,websocket
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: No Input/Output (Daemon)
Classifier: Framework :: Twisted
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Communications
Classifier: Topic :: Internet
Classifier: Topic :: Internet :: WWW/HTTP
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Topic :: Software Development :: Object Brokering
Classifier: Topic :: System :: Distributed Computing
Requires-Python: >=3.11
Requires-Dist: cbor2>=5.2.0
Requires-Dist: cffi>=2.0.0
Requires-Dist: cryptography>=3.4.6
Requires-Dist: hyperlink>=21.0.0
Requires-Dist: importlib-resources>=5.0.0; python_version < '3.10'
Requires-Dist: msgpack>=1.0.2; platform_python_implementation == 'CPython'
Requires-Dist: py-ubjson>=0.16.1
Requires-Dist: txaio>=25.12.2
Requires-Dist: u-msgpack-python>=2.1; platform_python_implementation != 'CPython'
Requires-Dist: ujson>=4.0.2
Provides-Extra: accelerate
Provides-Extra: all
Requires-Dist: argon2-cffi>=20.1.0; extra == 'all'
Requires-Dist: attrs>=20.3.0; extra == 'all'
Requires-Dist: base58>=2.1.1; extra == 'all'
Requires-Dist: brotli>=1.0.0; (platform_python_implementation == 'CPython') and extra == 'all'
Requires-Dist: brotlicffi>=1.0.0; (platform_python_implementation != 'CPython') and extra == 'all'
Requires-Dist: ecdsa>=0.19.1; extra == 'all'
Requires-Dist: passlib>=1.7.4; extra == 'all'
Requires-Dist: pynacl>=1.4.0; extra == 'all'
Requires-Dist: pyopenssl>=20.0.1; extra == 'all'
Requires-Dist: pytrie>=0.4.0; extra == 'all'
Requires-Dist: qrcode>=7.3.1; extra == 'all'
Requires-Dist: service-identity>=18.1.0; extra == 'all'
Requires-Dist: twisted>=22.10.0; extra == 'all'
Requires-Dist: zope-interface>=5.2.0; extra == 'all'
Provides-Extra: asyncio
Provides-Extra: benchmark
Requires-Dist: humanize>=4.0.0; extra == 'benchmark'
Requires-Dist: jinja2>=3.0.0; extra == 'benchmark'
Requires-Dist: vmprof-flamegraph>=0.0.1; (python_version >= '3.11') and extra == 'benchmark'
Requires-Dist: vmprof>=0.4.15; (python_version >= '3.11') and extra == 'benchmark'
Provides-Extra: build-tools
Requires-Dist: auditwheel>=5.0.0; (sys_platform == 'linux') and extra == 'build-tools'
Requires-Dist: build>=1.0.0; extra == 'build-tools'
Requires-Dist: wheel>=0.36.2; extra == 'build-tools'
Provides-Extra: compress
Requires-Dist: brotli>=1.0.0; (platform_python_implementation == 'CPython') and extra == 'compress'
Requires-Dist: brotlicffi>=1.0.0; (platform_python_implementation != 'CPython') and extra == 'compress'
Provides-Extra: dev
Requires-Dist: auditwheel>=5.0.0; (sys_platform == 'linux') and extra == 'dev'
Requires-Dist: backports-tempfile>=1.0; extra == 'dev'
Requires-Dist: build>=1.0.0; extra == 'dev'
Requires-Dist: bumpversion>=0.5.3; extra == 'dev'
Requires-Dist: codecov>=2.0.15; extra == 'dev'
Requires-Dist: furo>=2024.7.0; extra == 'dev'
Requires-Dist: humanize>=4.0.0; extra == 'dev'
Requires-Dist: linkify-it-py>=2.0.0; extra == 'dev'
Requires-Dist: myst-parser>=2.0; extra == 'dev'
Requires-Dist: passlib; extra == 'dev'
Requires-Dist: pep8-naming>=0.3.3; extra == 'dev'
Requires-Dist: pyenchant>=3.2; extra == 'dev'
Requires-Dist: pyflakes>=1.0.0; extra == 'dev'
Requires-Dist: pyinstaller>=4.2; extra == 'dev'
Requires-Dist: pylint>=1.9.2; extra == 'dev'
Requires-Dist: pytest-aiohttp; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.14.0; extra == 'dev'
Requires-Dist: pytest-runner>=2.11.1; extra == 'dev'
Requires-Dist: pytest>=3.4.2; extra == 'dev'
Requires-Dist: pyyaml>=4.2b4; extra == 'dev'
Requires-Dist: qualname>=0.1.0; extra == 'dev'
Requires-Dist: ruff>=0.12.1; extra == 'dev'
Requires-Dist: scour>=0.38; extra == 'dev'
Requires-Dist: sphinx-autoapi>=2.1.0; extra == 'dev'
Requires-Dist: sphinx-copybutton>=0.5; extra == 'dev'
Requires-Dist: sphinx-design>=0.5; extra == 'dev'
Requires-Dist: sphinx>=8.2.3; extra == 'dev'
Requires-Dist: sphinxcontrib-images>=0.9; extra == 'dev'
Requires-Dist: sphinxcontrib-spelling>=8.0; extra == 'dev'
Requires-Dist: sphinxext-opengraph>=0.9; extra == 'dev'
Requires-Dist: twine>=3.3.0; extra == 'dev'
Requires-Dist: twisted>=22.10.0; extra == 'dev'
Requires-Dist: txaio>=25.12.2; extra == 'dev'
Requires-Dist: watchdog>=0.8.3; extra == 'dev'
Requires-Dist: wheel>=0.36.2; extra == 'dev'
Requires-Dist: yapf==0.29.0; extra == 'dev'
Provides-Extra: docs
Requires-Dist: furo>=2024.7.0; extra == 'docs'
Requires-Dist: linkify-it-py>=2.0.0; extra == 'docs'
Requires-Dist: myst-parser>=2.0; extra == 'docs'
Requires-Dist: pyenchant>=3.2; extra == 'docs'
Requires-Dist: scour>=0.38; extra == 'docs'
Requires-Dist: sphinx-autoapi>=2.1.0; extra == 'docs'
Requires-Dist: sphinx-copybutton>=0.5; extra == 'docs'
Requires-Dist: sphinx-design>=0.5; extra == 'docs'
Requires-Dist: sphinx>=8.2.3; extra == 'docs'
Requires-Dist: sphinxcontrib-images>=0.9; extra == 'docs'
Requires-Dist: sphinxcontrib-spelling>=8.0; extra == 'docs'
Requires-Dist: sphinxext-opengraph>=0.9; extra == 'docs'
Provides-Extra: encryption
Requires-Dist: base58>=2.1.1; extra == 'encryption'
Requires-Dist: ecdsa>=0.19.1; extra == 'encryption'
Requires-Dist: pynacl>=1.4.0; extra == 'encryption'
Requires-Dist: pyopenssl>=20.0.1; extra == 'encryption'
Requires-Dist: pytrie>=0.4.0; extra == 'encryption'
Requires-Dist: qrcode>=7.3.1; extra == 'encryption'
Requires-Dist: service-identity>=18.1.0; extra == 'encryption'
Provides-Extra: nvx
Provides-Extra: scram
Requires-Dist: argon2-cffi>=20.1.0; extra == 'scram'
Requires-Dist: passlib>=1.7.4; extra == 'scram'
Provides-Extra: serialization
Provides-Extra: twisted
Requires-Dist: attrs>=20.3.0; extra == 'twisted'
Requires-Dist: twisted>=22.10.0; extra == 'twisted'
Requires-Dist: zope-interface>=5.2.0; extra == 'twisted'
Description-Content-Type: text/markdown

# Autobahn|Python

WebSocket & WAMP for Python on Twisted and asyncio.

[![PyPI](https://img.shields.io/pypi/v/autobahn.svg)](https://pypi.python.org/pypi/autobahn)
[![Python](https://img.shields.io/pypi/pyversions/autobahn.svg)](https://pypi.python.org/pypi/autobahn)
[![CI](https://github.com/crossbario/autobahn-python/workflows/main/badge.svg)](https://github.com/crossbario/autobahn-python/actions?query=workflow%3Amain)
[![CI (wstest)](https://github.com/crossbario/autobahn-python/workflows/wstest/badge.svg)](https://github.com/crossbario/autobahn-python/actions?query=workflow%3Awstest)
[![CD (wheels)](https://github.com/crossbario/autobahn-python/workflows/wheels/badge.svg)](https://github.com/crossbario/autobahn-python/actions?query=workflow%3Awheels)
[![CD (wheels-arm64)](https://github.com/crossbario/autobahn-python/workflows/wheels-arm64/badge.svg)](https://github.com/crossbario/autobahn-python/actions?query=workflow%3Awheels-arm64)
[![CD (wheels-docker)](https://github.com/crossbario/autobahn-python/workflows/wheels-docker/badge.svg)](https://github.com/crossbario/autobahn-python/actions?query=workflow%3Awheels-docker)
[![Docs](https://readthedocs.org/projects/autobahn/badge/?version=latest)](https://autobahn.readthedocs.io/en/latest/)
[![License](https://img.shields.io/pypi/l/autobahn.svg)](https://github.com/crossbario/autobahn-python/blob/master/LICENSE)
[![Downloads](https://img.shields.io/pypi/dm/autobahn.svg)](https://pypi.python.org/pypi/autobahn)

---

**Quick Links**:
[Source Code](https://github.com/crossbario/autobahn-python) -
[Documentation](https://autobahn.readthedocs.io/en/latest/) -
[WebSocket Examples](https://autobahn.readthedocs.io/en/latest/websocket/examples.html) -
[WAMP Examples](https://autobahn.readthedocs.io/en/latest/wamp/examples.html)
**Community**:
[Forum](https://crossbar.discourse.group/) -
[StackOverflow](https://stackoverflow.com/questions/tagged/autobahn) -
[Twitter](https://twitter.com/autobahnws) -
[IRC \#autobahn/chat.freenode.net](https://webchat.freenode.net/)
**Companion
Projects**:
[Autobahn|JS](https://github.com/crossbario/autobahn-js/) -
[Autobahn|Cpp](https://github.com/crossbario/autobahn-cpp) -
[Autobahn|Testsuite](https://github.com/crossbario/autobahn-testsuite) -
[Crossbar.io](https://crossbar.io) -
[WAMP](https://wamp-proto.org)

## Introduction

**Autobahn|Python** is a subproject of
[Autobahn](https://crossbar.io/autobahn) and provides open-source
implementations of

- [The WebSocket Protocol](https://tools.ietf.org/html/rfc6455)
- [The Web Application Messaging Protocol (WAMP)](https://wamp-proto.org/)

for Python 3.7+ and running on
[Twisted](https://twistedmatrix.com/) and
[asyncio](https://docs.python.org/3/library/asyncio.html).

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](https://crossbario.com/blog/post/websocket-why-what-can-i-use-it/)
and beyond, while [WAMP](https://wamp-proto.org/) 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](https://tools.ietf.org/html/rfc6455).
WAMP is a _routed_ protocol, so you need a **WAMP Router** to
connect your **Autobahn|Python** based clients. We provide
[Crossbar.io](https://crossbar.io), but there are
[other options](https://wamp-proto.org/implementations.html#routers)
as well.

Note

**Autobahn|Python** up to version v19.11.2 supported Python 2 and
3.4+, and up to version v20.7.1 supported Python 3.5+, and up to
version v21.2.1 supported Python 3.6+.

## Features

- framework for [WebSocket](https://tools.ietf.org/html/rfc6455)
  and [WAMP](https://wamp-proto.org/) clients and servers
- runs on [CPython](https://python.org/) and
  <span class="title-ref">PyPy &lt;https://pypy.org/&gt;</span>
- runs under [Twisted](https://twistedmatrix.com/) and
  [asyncio](https://docs.python.org/3/library/asyncio.html) -
  implements WebSocket
  [RFC6455](https://tools.ietf.org/html/rfc6455) and Draft
  Hybi-10+
- implements
  [WebSocket compression](https://tools.ietf.org/html/draft-ietf-hybi-permessage-compression)
- implements [WAMP](https://wamp-proto.org/), the Web Application
  Messaging Protocol
- high-performance, fully asynchronous implementation
- best-in-class standards conformance (100% strict passes with
  [Autobahn Testsuite](https://crossbar.io/autobahn#testsuite):
  [Client](https://autobahn.ws/testsuite/reports/clients/index.html)
  [Server](https://autobahn.ws/testsuite/reports/servers/index.html))
- message-, frame- and streaming-APIs for WebSocket
- supports TLS (secure WebSocket) and proxies
- Open-source
  ([MIT license](https://github.com/crossbario/autobahn-python/blob/master/LICENSE))

---

## AI Policy

> **IMPORTANT: A Note on Upcoming Policy Changes Regarding AI-Assisted Content**
>
> Up to and including release **v25.6.1**, this project contains no code
> or documentation generated with the assistance of AI tools. This version
> represents the final release under our historical contribution policy.
> Starting with future versions (*after* release v25.6.1), our contribution policy
> will change. Subsequent releases **MAY** contain code or documentation
> created with AI assistance.

We urge all users and contributors to review our [AI
Policy](https://github.com/crossbario/autobahn-python/blob/master/AI_POLICY.md).
This document details:

-   The rules and warranties required for all future contributions.
-   The potential intellectual property implications for the project and
    its users.

This policy was established following an open community discussion,
which you can review on [GitHub issue
\#1663](https://github.com/crossbario/autobahn-python/issues/1663).

We are providing this transparent notice to enable you to make an
informed decision. If our new AI policy is incompatible with your own
(or your organization's) development practices or risk tolerance, please
take this into consideration when deciding whether to upgrade beyond
version v25.6.1.


## Show me some code

To give you a first impression, here are two examples. We have
lot more
[in the repo](https://github.com/crossbario/autobahn-python/tree/master/examples).

### WebSocket Echo Server

Here is a simple WebSocket Echo Server that will echo back any
WebSocket message received:

    from autobahn.twisted.websocket import WebSocketServerProtocol
    # or: from autobahn.asyncio.websocket import WebSocketServerProtocol

    class MyServerProtocol(WebSocketServerProtocol):

        def onConnect(self, request):
            print("Client connecting: {}".format(request.peer))

        def onOpen(self):
            print("WebSocket connection open.")

        def onMessage(self, payload, isBinary):
            if isBinary:
                print("Binary message received: {} bytes".format(len(payload)))
            else:
                print("Text message received: {}".format(payload.decode('utf8')))

            # echo back message verbatim
            self.sendMessage(payload, isBinary)

        def onClose(self, wasClean, code, reason):
            print("WebSocket connection closed: {}".format(reason))

To actually run above server protocol, you need some lines of
[boilerplate](https://autobahn.readthedocs.io/en/latest/websocket/programming.html#running-a-server).

### WAMP Application Component

Here is a WAMP Application Component that performs all four types
of actions that WAMP provides:

1.  **subscribe** to a topic
2.  **publish** an event
3.  **register** a procedure
4.  **call** a procedure

<!-- -->

    from autobahn.twisted.wamp import ApplicationSession
    # or: from autobahn.asyncio.wamp import ApplicationSession

    class MyComponent(ApplicationSession):

        @inlineCallbacks
        def onJoin(self, details):

            # 1. subscribe to a topic so we receive events
            def onevent(msg):
                print("Got event: {}".format(msg))

            yield self.subscribe(onevent, 'com.myapp.hello')

            # 2. publish an event to a topic
            self.publish('com.myapp.hello', 'Hello, world!')

            # 3. register a procedure for remote calling
            def add2(x, y):
                return x + y

            self.register(add2, 'com.myapp.add2')

            # 4. call a remote procedure
            res = yield self.call('com.myapp.add2', 2, 3)
            print("Got result: {}".format(res))

Above code will work on Twisted and asyncio by changing a single
line (the base class of `MyComponent`). To actually run above
application component, you need some lines of
[boilerplate](https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-components)
and a
[WAMP Router](https://autobahn.readthedocs.io/en/latest/wamp/programming.html#running-a-wamp-router).

## Packaging

The Autobahn|Python OSS project:

- build & publish *binary wheels* on [GitHub Releases](https://github.com/crossbario/autobahn-python/releases) and [PyPI](https://pypi.org/project/autobahn/)
- plans to publish on [pyx](https://astral.sh/blog/introducing-pyx) once that launches
- plans to support [WheelNext](https://wheelnext.dev/) once that launches (see also: https://lwn.net/Articles/1028299/, https://labs.quansight.org/blog/python-wheels-from-tags-to-variants)
- no longer bakes & publishes Docker images *
- no longer explicitly supports [PyInstaller](https://pyinstaller.org/) packaging

> *: for commercial users, *typedef int GmbH (Germany)*, original creator and active maintainer of Autobahn, Crossbar.io and WAMP provides production grade, optimized and supported Docker images based on RHEL 9 and Debian 12, including complete SBOM for both the base system and full Python application run-time environment based on [CycloneDX v1.6](https://cyclonedx.org/) in JSON format and as a audit-level PDF/A document fulfilling strict cybersecurity requirements addressing e.g. EU CRA and [BSI TR-03183](https://www.bsi.bund.de/DE/Themen/Unternehmen-und-Organisationen/Standards-und-Zertifizierung/Technische-Richtlinien/TR-nach-Thema-sortiert/tr03183/TR-03183_node.html).

## Package Releases

Autobahn|Python provides comprehensive binary wheel coverage for all major platforms and Python implementations.

### Generic

- **Source distribution**: `autobahn-25.9.1.tar.gz`
- **Pure Python 3 wheel**: `autobahn-25.9.1-py3-none-any.whl`

> **Note**: The pure Python wheel cannot include NVX (Native Vector Extensions) optimizations and will fall back to pure Python implementations. This provides maximum compatibility but slower performance compared to platform-specific wheels with native CFFI extensions.

### Linux

Available for x86_64 architecture with native CFFI extensions:

- `autobahn-25.9.1-cp311-cp311-linux_x86_64.whl`
- `autobahn-25.9.1-cp312-cp312-linux_x86_64.whl`
- `autobahn-25.9.1-cp313-cp313-linux_x86_64.whl`
- `autobahn-25.9.1-cp314-cp314-linux_x86_64.whl`
- `autobahn-25.9.1-pp311-pypy311_pp73-linux_x86_64.whl`

### macOS

Available for Apple Silicon (ARM64) architecture:

- `autobahn-25.9.1-cp312-cp312-macosx_15_0_arm64.whl`
- `autobahn-25.9.1-cp313-cp313-macosx_15_0_arm64.whl`
- `autobahn-25.9.1-cp314-cp314-macosx_11_0_arm64.whl`
- `autobahn-25.9.1-pp311-pypy311_pp73-macosx_11_0_arm64.whl`

### Windows

Available for x86_64 (AMD64) architecture:

- `autobahn-25.9.1-cp311-cp311-win_amd64.whl`
- `autobahn-25.9.1-cp312-cp312-win_amd64.whl`
- `autobahn-25.9.1-cp313-cp313-win_amd64.whl`
- `autobahn-25.9.1-cp314-cp314-win_amd64.whl`
- `autobahn-25.9.1-pp311-pypy311_pp73-win_amd64.whl`

All wheels include native CFFI extensions for optimal performance and are available from [PyPI](https://pypi.org/project/autobahn/) and [GitHub Releases](https://github.com/crossbario/autobahn-python/releases).

## Extensions

### Networking framework

Autobahn runs on both Twisted and asyncio. To select the
respective netoworking framework, install flavor:

- `asyncio`: Install asyncio (when on Python 2, otherwise it's
  included in the standard library already) and asyncio support
  in Autobahn
- `twisted`: Install Twisted and Twisted support in Autobahn

---

### WebSocket Acceleration and Compression

#### Acceleration (Deprecated)

The `accelerate` optional dependency is **no longer recommended**. Autobahn now includes **NVX** (Native Vector Extensions), which provides SIMD-accelerated native code for WebSocket operations (XOR masking and UTF-8 validation) using CFFI. See the [NVX section](#native-vector-extensions-nvx) below for details.

- ~~`accelerate`~~: Deprecated - Use NVX instead

#### Compression

Autobahn supports multiple WebSocket per-message compression algorithms via the `compress` optional dependency:

    pip install autobahn[compress]

**Compression Methods Available:**

| Method | Availability | Standard | Implementation | Notes |
|--------|--------------|----------|----------------|-------|
| **permessage-deflate** | Always | [RFC 7692](https://datatracker.ietf.org/doc/html/rfc7692) | Python stdlib (zlib) | Standard WebSocket compression |
| **permessage-brotli** | `[compress]` | [RFC 7932](https://datatracker.ietf.org/doc/html/rfc7932) | brotli / brotlicffi | **Recommended** - Best compression ratio |
| **permessage-bzip2** | Optional | Non-standard | Python stdlib (bz2) | Requires Python built with libbz2 |
| **permessage-snappy** | Manual install | Non-standard | python-snappy | Requires separate installation |

**Platform-Optimized Brotli Support:**

Autobahn includes **Brotli compression** with full binary wheel coverage optimized for both CPython and PyPy:

- **CPython**: Uses [brotli](https://github.com/google/brotli) (Google's official package, CPyExt)
- **PyPy**: Uses [brotlicffi](https://github.com/python-hyper/brotlicffi) (CFFI-based, optimized for PyPy)

**Advantages of Brotli:**
- **Superior compression ratio** compared to deflate or snappy
- **Binary wheels** for all major platforms (Linux x86_64/ARM64, macOS x86_64/ARM64, Windows x86_64)
- **IETF standard** ([RFC 7932](https://datatracker.ietf.org/doc/html/rfc7932)) for HTTP compression
- **Fast decompression** suitable for real-time applications
- **Widely adopted** by browsers and CDNs

**Resources:**
- [RFC 7932 - Brotli Compressed Data Format](https://datatracker.ietf.org/doc/html/rfc7932)
- [Google Brotli](https://github.com/google/brotli) - Official implementation
- [brotlicffi](https://github.com/python-hyper/brotlicffi) - CFFI bindings for PyPy
- [PyPI: brotlicffi](https://pypi.org/project/brotlicffi/)
- [WAMP Brotli Extension Discussion](https://github.com/wamp-proto/wamp-proto/issues/555)

**Note on Snappy:**

[Snappy](https://github.com/google/snappy) compression is available but requires manual installation of [python-snappy](https://pypi.org/project/python-snappy/) (no binary wheels):

    pip install python-snappy  # Requires libsnappy-dev system library

For most use cases, **Brotli is recommended** over Snappy due to better compression ratios and included binary wheels.

---

### Encryption and WAMP authentication

Autobahn supports running over TLS (for WebSocket and all WAMP
transports) as well as **WAMP-cryposign** authentication.

To install use this flavor:

- `encryption`: Installs TLS and WAMP-cryptosign dependencies

Autobahn also supports **WAMP-SCRAM** authentication. To install:

- `scram`: Installs WAMP-SCRAM dependencies

---

### Native vector extensions (NVX)

&gt; This is NOT yet complete - ALPHA!

Autobahn contains **NVX**, a network accelerator library that
provides SIMD accelerated native vector code for WebSocket (XOR
masking) and UTF-8 validation.

> NVX lives in namespace
> <span class="title-ref">autobahn.nvx</span> and currently
> requires a x86-86 CPU with at least SSE2 and makes use of
> SSE4.1 if available. The code is written using vector
> instrinsics, should compile with both GCC and Clang,and
> interfaces with Python using CFFI, and hence runs fast on PyPy.

---

### WAMP Serializers

**As of v25.11.1, all WAMP serializers are included by default** - batteries included!

Autobahn|Python now ships with full support for all WAMP serializers out-of-the-box:

- **JSON** (standard library) - always available
- **MessagePack** - high-performance binary serialization
- **CBOR** - IETF standard binary serialization (RFC 8949)
- **UBJSON** - Universal Binary JSON
- **Flatbuffers** - Google's zero-copy serialization (vendored)

#### Architecture & Performance

The serializer dependencies are optimized for both **CPython** and **PyPy**:

| Serializer | CPython | PyPy | Wheel Type | Notes |
|------------|---------|------|------------|-------|
| **json** | stdlib | stdlib | - | Always available |
| **msgpack** | Binary wheel (C extension) | u-msgpack-python (pure Python) | Native + Universal | PyPy JIT makes pure Python faster than C |
| **ujson** | Binary wheel | Binary wheel | Native | Available for both implementations |
| **cbor2** | Binary wheel | Pure Python fallback | Native + Universal | Binary wheels + py3-none-any |
| **ubjson** | Pure Python | Pure Python | Source | Set `PYUBJSON_NO_EXTENSION=1` to skip C build |
| **flatbuffers** | Vendored | Vendored | Included | Always available, no external dependency |

**Key Design Principles:**

1. **Batteries Included**: All serializers available without extra install steps
2. **PyPy Optimization**: Pure Python implementations leverage PyPy's JIT for superior performance
3. **Binary Wheels**: Native wheels for all major platforms (Linux x86_64/ARM64, macOS x86_64/ARM64, Windows x86_64)
4. **Zero System Pollution**: All dependencies install cleanly via wheels or pure Python
5. **WAMP Compliance**: Full protocol support out-of-the-box

**Total Additional Size**: ~590KB (negligible compared to full application install)

#### Platform Coverage

All serializer dependencies provide binary wheels for:
- **Linux**: x86_64, ARM64 (manylinux, musllinux)
- **macOS**: x86_64 (Intel), ARM64 (Apple Silicon)
- **Windows**: x86_64 (AMD64), ARM64
- **Python**: 3.11, 3.12, 3.13, 3.14 (including 3.14t free-threaded)
- **Implementations**: CPython, PyPy 3.11+

#### Backwards Compatibility

The `serialization` optional dependency is maintained for backwards compatibility:

    pip install autobahn[serialization]  # Still works, but now a no-op

#### ujson Acceleration

To speed up JSON on CPython using the faster `ujson`, set:

    AUTOBAHN_USE_UJSON=1

> **Warning**: Using `ujson` will break the ability of Autobahn to transport and translate binary application payloads in WAMP transparently. This ability depends on features of the standard library `json` module not available in `ujson`.

#### Recommendations

- **General use**: JSON (stdlib) or CBOR
- **High performance**: MessagePack or Flatbuffers
- **Strict standards**: CBOR (IETF RFC 8949)
- **Zero-copy**: Flatbuffers (for large payloads)

---

## Dependency Analysis

**Autobahn|Python is fully optimized for both CPython and PyPy with comprehensive binary wheel coverage.**

All dependencies follow these design principles:

1. **CFFI over CPyExt**: All native extensions use CFFI for optimal PyPy compatibility
2. **Binary Wheels First**: Native wheels available for all major platforms
3. **PyPy-Optimized**: Platform-specific packages leverage PyPy's JIT compiler
4. **Zero System Pollution**: No system libraries or build tools required for installation

### Core Dependencies

| Dependency | Purpose | CPython | PyPy | Wheel Coverage | Notes |
|------------|---------|---------|------|----------------|-------|
| **txaio** | Twisted/asyncio abstraction | Universal wheel | Universal wheel | ✅ Excellent | Pure Python, works everywhere |
| **cryptography** | TLS, X.509, cryptographic primitives | Binary wheel (Rust+CFFI) | Binary wheel (Rust+CFFI) | ✅ Excellent | 40+ wheels per release |
| **hyperlink** | URL parsing | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |

### WAMP Serializers (Batteries Included)

All serializers are now **included by default** in the base installation:

| Serializer | Purpose | CPython | PyPy | Wheel Coverage | Notes |
|------------|---------|---------|------|----------------|-------|
| **json** | JSON serialization | stdlib | stdlib | ✅ Always available | Python standard library |
| **msgpack** | MessagePack serialization | msgpack (binary wheel) | u-msgpack-python (pure Python) | ✅ Excellent | 50+ wheels for CPython; PyPy JIT optimized |
| **ujson** | Fast JSON (optional) | Binary wheel | Binary wheel | ✅ Excellent | 30+ wheels; both implementations |
| **cbor2** | CBOR serialization (RFC 8949) | Binary wheel | Pure Python fallback | ✅ Excellent | 30+ binary wheels + universal fallback |
| **py-ubjson** | UBJSON serialization | Pure Python | Pure Python | ✅ Good | Optional C extension (can skip with `PYUBJSON_NO_EXTENSION=1`) |
| **flatbuffers** | Google Flatbuffers | **Vendored** | **Vendored** | ✅ Perfect | Included in our wheel, zero external dependency |

### Optional: Twisted Framework

Available via `pip install autobahn[twisted]`:

| Dependency | Purpose | CPython | PyPy | Wheel Coverage | Notes |
|------------|---------|---------|------|----------------|-------|
| **zope.interface** | Component architecture | Binary wheel | Binary wheel | ✅ Excellent | 40+ wheels |
| **twisted** | Async networking framework | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |
| **attrs** | Class attributes | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |

### Optional: WebSocket Compression

Available via `pip install autobahn[compress]`:

| Compression Method | CPython | PyPy | Wheel Coverage | Standards | Notes |
|-------------------|---------|------|----------------|-----------|-------|
| **permessage-deflate** | stdlib (zlib) | stdlib (zlib) | ✅ Always available | RFC 7692 | Python standard library |
| **permessage-brotli** | brotli (CPyExt) | brotlicffi (CFFI) | ✅ Excellent | RFC 7932 | 40+ wheels (brotli), 20+ wheels (brotlicffi) |
| **permessage-bzip2** | stdlib (bz2) | stdlib (bz2) | ✅ Always available | Non-standard | Python standard library |
| **permessage-snappy** | python-snappy (optional) | python-snappy (optional) | ⚠️ No wheels | Non-standard | Manual install; requires libsnappy-dev |

**Recommendation**: Use **permessage-brotli** for optimal compression with full binary wheel support.

### Optional: Encryption & WAMP Authentication

Available via `pip install autobahn[encryption]`:

| Dependency | Purpose | CPython | PyPy | Wheel Coverage | Notes |
|------------|---------|---------|------|----------------|-------|
| **pyopenssl** | TLS/SSL operations | Universal wheel | Universal wheel | ✅ Excellent | Pure Python wrapper |
| **service-identity** | TLS service verification | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |
| **pynacl** | NaCl cryptography | Binary wheel (CFFI) | Binary wheel (CFFI) | ✅ Excellent | 30+ CFFI wheels |
| **pytrie** | Trie data structure | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |
| **qrcode** | QR code generation | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |
| **base58** | Base58 encoding | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |
| **ecdsa** | ECDSA signatures | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |

### Optional: WAMP-SCRAM Authentication

Available via `pip install autobahn[scram]`:

| Dependency | Purpose | CPython | PyPy | Wheel Coverage | Notes |
|------------|---------|---------|------|----------------|-------|
| **cffi** | C Foreign Function Interface | Binary wheel | Binary wheel | ✅ Excellent | 40+ wheels including PyPy |
| **argon2-cffi** | Argon2 password hashing | Binary wheel (CFFI) | Binary wheel (CFFI) | ✅ Excellent | 30+ CFFI wheels including PyPy |
| **passlib** | Password hashing framework | Universal wheel | Universal wheel | ✅ Excellent | Pure Python |

### Optional: Native Vector Extensions (NVX)

Available via `pip install autobahn[nvx]`:

| Feature | Implementation | CPython | PyPy | Coverage | Notes |
|---------|---------------|---------|------|----------|-------|
| **XOR Masking** | SIMD via CFFI | ✅ Yes | ✅ Yes | ✅ Excellent | Our own CFFI-based implementation |
| **UTF-8 Validation** | SIMD via CFFI | ✅ Yes | ✅ Yes | ✅ Excellent | Our own CFFI-based implementation |

**NVX** provides significant performance improvements for WebSocket operations using SIMD instructions through CFFI.

### Platform Coverage Summary

**Binary wheels available for:**
- **Operating Systems**: Linux (glibc/musl), macOS, Windows
- **Architectures**: x86_64 (Intel/AMD), ARM64 (Apple Silicon, AWS Graviton)
- **Python Versions**: 3.11, 3.12, 3.13, 3.14 (including free-threaded 3.14t)
- **Implementations**: CPython, PyPy 3.11+

**All optional dependencies install cleanly without:**
- System libraries (except optional python-snappy)
- Build tools (gcc, make, etc.)
- Package managers (apt, yum, brew)

### Verdict

✅ **Autobahn|Python achieves its goals:**

1. ✅ **Batteries Included**: All core WAMP serializers shipped by default
2. ✅ **CPython & PyPy**: Full support for both implementations
3. ✅ **CFFI Everywhere**: All native extensions use CFFI (PyPy-optimized)
4. ✅ **Binary Wheels**: Comprehensive coverage across platforms/architectures
5. ✅ **Zero System Dependencies**: Clean pip install on all platforms
6. ✅ **Performance**: Native SIMD (NVX), optimized serializers, Brotli compression

**There is nothing more to optimize or wish for** - the dependency strategy is complete and optimal.
