{"id":36938915,"url":"https://github.com/puddly/serialx","last_synced_at":"2026-06-08T20:31:09.482Z","repository":{"id":128760355,"uuid":"528918995","full_name":"puddly/serialx","owner":"puddly","description":"Serial library with native async support for Linux, macOS, Windows, and WebSerial","archived":false,"fork":false,"pushed_at":"2026-06-08T01:07:38.000Z","size":1513,"stargazers_count":21,"open_issues_count":3,"forks_count":5,"subscribers_count":5,"default_branch":"dev","last_synced_at":"2026-06-08T01:14:09.209Z","etag":null,"topics":["pyodide","python","serial","webserial"],"latest_commit_sha":null,"homepage":"https://puddly.github.io/serialx/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/puddly.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2022-08-25T15:50:23.000Z","updated_at":"2026-06-02T13:26:04.000Z","dependencies_parsed_at":"2026-03-07T02:08:02.455Z","dependency_job_id":null,"html_url":"https://github.com/puddly/serialx","commit_stats":null,"previous_names":["puddly/serialx"],"tags_count":30,"template":false,"template_full_name":null,"purl":"pkg:github/puddly/serialx","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puddly%2Fserialx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puddly%2Fserialx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puddly%2Fserialx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puddly%2Fserialx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/puddly","download_url":"https://codeload.github.com/puddly/serialx/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/puddly%2Fserialx/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34080025,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-08T02:00:07.615Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["pyodide","python","serial","webserial"],"created_at":"2026-01-13T10:22:28.311Z","updated_at":"2026-06-08T20:31:09.459Z","avatar_url":"https://github.com/puddly.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Introduction\nSerialx is a no-compromise serial communication library for Python targeting common\nplatforms such as Linux (POSIX), macOS, and Windows. It provides both synchronous and\nnative asynchronous APIs for all platforms.\n\n**For more information, visit serialx's documentation: https://puddly.github.io/serialx/**\n\n# Installation\n```console\npip install serialx\n```\n\nFor drop-in import compatibility (`serial`, `serial_asyncio`, `serial_asyncio_fast`), install:\n```console\npip install serialx-compat\n```\n\n# Usage\nSerialx features a familiar synchronous API:\n\n```Python\nimport serialx\n\nwith serialx.serial_for_url(\"/dev/serial/by-id/port\", baudrate=115200) as serial:\n    data = serial.readexactly(5)\n    serial.write(b\"test\")\n\n    serial.set_modem_pins(rts=True, dtr=True)\n    pins = serial.get_modem_pins()\n    assert pins.rts is serialx.PinState.HIGH\n    assert pins.dtr is serialx.PinState.HIGH\n```\n\nA high-level asynchronous serial `(reader, writer)` pair:\n\n```Python\nimport asyncio\nimport contextlib\n\nimport serialx\n\nasync def main():\n\treader, writer = await serialx.open_serial_connection(\"/dev/serial/by-id/port\", baudrate=115200)\n\n\twith contextlib.closing(writer):\n\t    data = await reader.readexactly(5)\n\t    writer.write(b\"test\")\n\t    await writer.drain()\n```\n\nAnd a low-level asynchronous serial transport:\n\n```Python\nimport asyncio\nimport serialx\n\nasync def main():\n\tloop = asyncio.get_running_loop()\n\tprotocol = YourProtocol()\n\n\ttransport, protocol = await serialx.create_serial_connection(\n\t    loop,\n\t    lambda: protocol,\n\t    url=\"/dev/serial/by-id/port\",\n\t    baudrate=115200\n\t)\n\n\tawait transport.set_modem_pins(rts=True, dtr=True)\n```\n\n## ESPHome serial proxy\nSerialx can communicate with serial devices exposed by [ESPHome](https://esphome.io/).\n\nIt can either create the API instance directly, for simplicity:\n\n```python\nfrom serialx import open_serial_connection\n\nreader, writer = await open_serial_connection(\n    url=\"esphome://192.168.1.42:6053/?port_name=Zigbee\u0026key=...\",\n    baudrate=115200,\n)\n```\n\nOr reuse an existing API instance, for efficiency:\n```python\nfrom aioesphomeapi import APIClient\nfrom serialx import open_serial_connection\nfrom serialx.platforms.serial_esphome import ESPHomeSerialTransport\n\n# An external API instance\napi = APIClient(address=\"192.168.1.42\", port=6053, key=\"...\", password=None)\nawait api.connect(login=True)\n\nreader, writer = await open_serial_connection(\n    url=None,\n    transport_cls=ESPHomeSerialTransport,\n    api=api,\n    port_name=\"Zigbee\",\n    baudrate=115200,\n)\n```\n\n# Development\nAll development dependencies are listed in `pyproject.toml`. To install them, use:\n```bash\nuv pip install '.[dev]'\n```\n\nOn macOS and Windows, a Rust toolchain is required to build the native serial port\nenumeration extension. Install Rust via [rustup](https://rustup.rs/).\n\nSet up pre-commit hooks with `pre-commit install`. Your code will then be type checked\nand auto-formatted when you run `git commit`. You can do this on-demand with\n`pre-commit run`.\n\nSerialx relies on automated testing. CI runs tests using both `socat` virtual PTYs\n(Linux/macOS) and socket-based serial pairs. To also test with physical adapter pairs,\npass CLI flags to `pytest`:\n\n```bash\npytest --adapter-pair=/dev/serial/by-id/left1:/dev/serial/by-id/right1 \\\n       --adapter-pair=/dev/serial/by-id/left2:/dev/serial/by-id/right2\n```\n\nBy default, tests run in parallel. You can disable this by passing `-n 0` to `pytest`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuddly%2Fserialx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpuddly%2Fserialx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpuddly%2Fserialx/lists"}