Skip to main content

samps

A hypermodern, type-safe, zero-dependency Python library for serial port I/O access.

Installation

pip install samps

or

using your preferred environment / package manager of choice, e.g., poetry, conda or uv:

poetry add samps
conda install samps
uv add samps

Usage

The general usage of this library is to create a serial connection to the device you want to communicate with.

You'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.

Once 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:

from samps import SerialCommonInterface as Serial

serial = Serial(port="/dev/tty.usbserial-0001", baudrate=9600)

serial.open()

print(["Serial Port Is Open?", "Yes" if serial.is_open() else "No"])

line = serial.readline()

print(line.decode("utf-8").strip())

serial.close()

print(["Serial Port Closed"])

or, using a context manager:

from samps import SerialCommonInterface as Serial

with Serial(port="/dev/tty.usbserial-0001", baudrate=9600) as serial:
    print(["Serial Port Is Open?", "Yes" if serial.is_open() else "No"])

    line = serial.readline()

    print(line.decode("utf-8").strip())

print(["Serial Port Closed"])

The library also provides an asynchronous interface for serial communication, which can be used in an asyncio event loop.

Here's an example of how to use the asynchronous interface:

from samps import SerialAsyncCommonInterface as Serial

async with Serial(port="/dev/tty.usbserial-0001", baudrate=9600) as serial:
    print(["Serial Port Is Open?", "Yes" if serial.is_open() else "No"])

    line = await serial.readline()

    print(line.decode("utf-8").strip())

print(["Serial Port Closed"])

Milestones

  • Implement SerialCommonInterface for POSIX systems
  • Implement SerialAsyncCommonInterface for POSIX systems
  • Implement SerialCommonInterface for Windows systems
  • Implement SerialAsyncCommonInterface for Windows systems
  • Implement SerialCommonInterface for MacOS systems
  • Implement SerialAsyncCommonInterface for MacOS systems
  • Implement SerialOverTCP (e.g., telnet RFC 2217)
  • Documentation

Contributing

Contributions are welcome! Please read the CONTRIBUTING.md file for details on how to contribute to this project.

License

This project is licensed under the terms of the MIT license.

Metadata

Release files for samps 0.12.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for samps 0.12.0
File Size Uploaded Provenance Actions
samps-0.12.0.tar.gz 62.1 kB With provenance Details for samps-0.12.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for samps 0.12.0
File Interpreter ABI Platform Actions
samps-0.12.0-py3-none-any.whl Python 3 none any Details for samps-0.12.0-py3-none-any.whl

Total release size: 95.2 kB

Release files / samps-0.12.0.tar.gz

Download URL samps-0.12.0.tar.gz
Size 62.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ae8d02f43f3b04940d3a87ed2aeb67a7c07316fb12995681424d1c5a7ca555f
BLAKE2b-256 checksum
How to use checksums
5dbfb938294b9a86364b72db49107f93691fdfce05d5c23f5ad0213bb406c4c4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Release files / samps-0.12.0-py3-none-any.whl

Download URL samps-0.12.0-py3-none-any.whl
Size 33.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
32231f3c40c9696016b1aac8c3192666740812ba82c3d5671e197cb0497919b9
BLAKE2b-256 checksum
How to use checksums
b9734234b019b7e3f39d1499ddb0e91932cfaaf31a434b28f876e481cf8581d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

Security for samps 0.12.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for samps-0.12.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page