{"id":28092829,"url":"https://github.com/michealroberts/samps","last_synced_at":"2026-03-03T04:32:31.370Z","repository":{"id":291743203,"uuid":"978060450","full_name":"michealroberts/samps","owner":"michealroberts","description":"Modern, type-safe, zero-dependency Python library for serial port I/O access","archived":false,"fork":false,"pushed_at":"2025-12-16T16:43:41.000Z","size":202,"stargazers_count":22,"open_issues_count":3,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-12-20T07:18:21.045Z","etag":null,"topics":["i2c","serial","spi","termios","uart","usb"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/michealroberts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","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":"2025-05-05T12:10:44.000Z","updated_at":"2025-12-16T16:43:45.000Z","dependencies_parsed_at":"2025-05-06T10:45:37.995Z","dependency_job_id":"0bd563b6-0790-47cb-b2bd-8b5af262ead3","html_url":"https://github.com/michealroberts/samps","commit_stats":null,"previous_names":["michealroberts/samps"],"tags_count":11,"template":false,"template_full_name":"michealroberts/astral-uv-python-package-template","purl":"pkg:github/michealroberts/samps","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Fsamps","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Fsamps/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Fsamps/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Fsamps/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/michealroberts","download_url":"https://codeload.github.com/michealroberts/samps/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/michealroberts%2Fsamps/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30031998,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T03:27:35.548Z","status":"ssl_error","status_checked_at":"2026-03-03T03:27:09.213Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"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":["i2c","serial","spi","termios","uart","usb"],"created_at":"2025-05-13T13:48:47.624Z","updated_at":"2026-03-03T04:32:31.364Z","avatar_url":"https://github.com/michealroberts.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# samps\n\nA hypermodern, type-safe, zero-dependency Python library for serial port I/O access.\n\n## Installation\n\n```bash\npip install samps\n```\n\nor\n\nusing your preferred environment / package manager of choice, e.g., `poetry`, `conda` or `uv`:\n\n```bash\npoetry add samps\n```\n\n```bash\nconda install samps\n```\n\n```bash\nuv add samps\n```\n\n## Usage\n\nThe general usage of this library is to create a serial connection to the device you want to communicate with.\n\nYou'll need to know the serial port name and the baudrate of the device you want to communicate with, this is usually found in the device's documentation.\n\nOnce you have the serial port name and baudrate, you can create a `SerialCommonInterface` (or `SerialAsyncCommonInterface`) object and use it to communicate with the device as follows:\n\n```python\nfrom samps import SerialCommonInterface as Serial\n\nserial = Serial(port=\"/dev/tty.usbserial-0001\", baudrate=9600)\n\nserial.open()\n\nprint([\"Serial Port Is Open?\", \"Yes\" if serial.is_open() else \"No\"])\n\nline = serial.readline()\n\nprint(line.decode(\"utf-8\").strip())\n\nserial.close()\n\nprint([\"Serial Port Closed\"])\n```\n\nor, using a context manager:\n\n```python\nfrom samps import SerialCommonInterface as Serial\n\nwith Serial(port=\"/dev/tty.usbserial-0001\", baudrate=9600) as serial:\n    print([\"Serial Port Is Open?\", \"Yes\" if serial.is_open() else \"No\"])\n\n    line = serial.readline()\n\n    print(line.decode(\"utf-8\").strip())\n\nprint([\"Serial Port Closed\"])\n```\n\nThe library also provides an asynchronous interface for serial communication, which can be used in an `asyncio` event loop. \n\nHere's an example of how to use the asynchronous interface:\n\n```python\nfrom samps import SerialAsyncCommonInterface as Serial\n\nasync with Serial(port=\"/dev/tty.usbserial-0001\", baudrate=9600) as serial:\n    print([\"Serial Port Is Open?\", \"Yes\" if serial.is_open() else \"No\"])\n\n    line = await serial.readline()\n\n    print(line.decode(\"utf-8\").strip())\n\nprint([\"Serial Port Closed\"])\n```\n\n## Milestones\n\n- [x] Implement SerialCommonInterface for POSIX systems\n- [x] Implement SerialAsyncCommonInterface for POSIX systems\n- [ ] Implement SerialCommonInterface for Windows systems\n- [ ] Implement SerialAsyncCommonInterface for Windows systems\n- [x] Implement SerialCommonInterface for MacOS systems\n- [x] Implement SerialAsyncCommonInterface for MacOS systems\n- [ ] Implement SerialOverTCP (e.g., telnet RFC 2217)\n- [ ] Documentation\n\n## Contributing\n\nContributions are welcome! Please read the [CONTRIBUTING.md](CONTRIBUTING.md) file for details on how to contribute to this project.\n\n### License\n\nThis project is licensed under the terms of the MIT license.\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichealroberts%2Fsamps","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmichealroberts%2Fsamps","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmichealroberts%2Fsamps/lists"}