Skip to main content

Manchester line encoder/decoder supporting IEEE and Thomas variants.

Project description

manchester_codec

Manchester line coding utilities with first-class support for the IEEE 802.3 and G.E. Thomas variants. The library exposes predictable helpers for bit-level and byte-level workflows so it can be embedded inside larger communication stacks or used interactively for quick experiments.

Features

  • Encode or decode Manchester symbols with a single function call.
  • Supports both IEEE (low→high transition represents 1) and Thomas (high→low represents 1) conventions.
  • Helper utilities to convert between bit sequences and byte payloads.
  • Fully typed, documented, and covered by tests to make PyPI publishing straightforward.

Installation

pip install manchester_codec

Until the project is uploaded to PyPI you can install it from a local checkout:

pip install .

Usage

from manchester_codec import (
    ManchesterStandard,
    encode_bits,
    decode_bits,
    encode_bytes,
    decode_bytes,
)

data_bits = "10110011"
encoded = encode_bits(data_bits, standard=ManchesterStandard.IEEE)
decoded = decode_bits(encoded, standard="ieee")  # standard can also be a string
assert "".join(str(bit) for bit in decoded) == data_bits

payload = bytes.fromhex("a5")
encoded_bytes = encode_bytes(payload, standard="thomas")
decoded_bytes = decode_bytes(encoded_bytes, standard="thomas")
assert decoded_bytes == payload

Development

python -m venv .venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
pip install -e .[dev]
pytest

Additional resources

License

MIT License. See LICENSE for details.

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

manchester_codec-0.3.0.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

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

manchester_codec-0.3.0-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file manchester_codec-0.3.0.tar.gz.

File metadata

  • Download URL: manchester_codec-0.3.0.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.1

File hashes

Hashes for manchester_codec-0.3.0.tar.gz
Algorithm Hash digest
SHA256 96e941b06ffb18b7906a11f69800e17e7b72bc9754eb83b2088332568b15b997
MD5 ef08588f379a2ca5d5fee98c426c67a7
BLAKE2b-256 924d5727c5fd2a41b080db452943a41c5001861e15398bf4dde0a444a1c7b315

See more details on using hashes here.

File details

Details for the file manchester_codec-0.3.0-py3-none-any.whl.

File metadata

File hashes

Hashes for manchester_codec-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fa3d08bd9acf5c31dbfc67f323cb9f7baeb35f0d1332ae13b2226e64200a1924
MD5 23b2a9950dd060b85ef86a095da7b98d
BLAKE2b-256 d876889113b00849cf568e5da08fc1e0722d487c0f0f57713ece1e9d31347183

See more details on using hashes here.

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