Skip to main content

Drop-in 1-to-N multiplexer for pySerial hardware serial interfaces

Project description

pySerialMux

Drop-in 1-to-N multiplexer for pyserial hardware serial interfaces.

Quick usage

from pySerialMux import Serial

with Serial("/dev/ttyUSB0", baudrate=115200, timeout=1.0) as ser:
  ser.write(b"hello\n")
  print(ser.readline())

On-demand QoL and debug options

The proxy accepts optional flags through Serial(...):

  • debug=True
    Enables debug logging for proxy/broker lifecycle details.

  • ignore_baudrate_diff=True
    Allows a client to connect even when its requested baudrate differs from the broker's baudrate.

  • virtual_interface="<name>"
    Enables virtual routing mode for that interface name.

  • client_id="<id>"
    Required when virtual_interface is used.

  • host_virtual_interface=True
    Marks the client as host for that virtual interface. Non-host clients writing to that interface are routed to the host client instead of physical serial.

Virtual interface example

# host side
host = Serial(
    "/dev/ttyUSB0",
    virtual_interface="lab-bus",
    client_id="host-1",
    host_virtual_interface=True,
)

# client side
client = Serial(
    "/dev/ttyUSB0",
    virtual_interface="lab-bus",
    client_id="client-1",
)

client.write(b"message to host")
print(host.read(15))

CI/CD

This repository includes GitHub Actions workflows for:

  • CI test matrix on push and pull requests (.github/workflows/ci.yml)
  • Auto publish to PyPI on GitHub release publish (.github/workflows/publish-pypi.yml)

For PyPI publishing, configure trusted publishing (OIDC) for this repository in the PyPI project settings and use the pypi GitHub environment.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pyserialmux-0.1.2.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pyserialmux-0.1.2-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

Details for the file pyserialmux-0.1.2.tar.gz.

File metadata

  • Download URL: pyserialmux-0.1.2.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyserialmux-0.1.2.tar.gz
Algorithm Hash digest
SHA256 f60cc006c46fd71509b4a77989a90f964d331b763b9fa85545ef28e6513599f6
MD5 d1879cb963e3e08db6313fd933a9a9da
BLAKE2b-256 d1d58ff4f609bc10211a84cde41e1d0d4d2105958707efb678c8240ed88aed7d

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyserialmux-0.1.2.tar.gz:

Publisher: publish-pypi.yml on KilianSen/pySerialMux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pyserialmux-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: pyserialmux-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 22.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pyserialmux-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 cca945b4af80bb59db4324b130503942c97593beafe101d498aad1278f1ede45
MD5 b1cdc6550524fdfef3fab7b3ce4b8ab8
BLAKE2b-256 30258e31354e94dc3771ffbe49e22700ead4f76a5fcce04a3a7bdda9717fca68

See more details on using hashes here.

Provenance

The following attestation bundles were made for pyserialmux-0.1.2-py3-none-any.whl:

Publisher: publish-pypi.yml on KilianSen/pySerialMux

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page