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.13.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.13.0
File Size Uploaded Provenance Actions
samps-0.13.0.tar.gz 70.9 kB With provenance Details for samps-0.13.0.tar.gz

Built distribution (wheel)

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

Total release size: 107.0 kB

Release files / samps-0.13.0.tar.gz

Download URL samps-0.13.0.tar.gz
Size 70.9 kB
Tags Source
SHA-256 checksum
How to use checksums
29b56710b5985927ab9280a4984da3ac27091c5d78c50a9b5bc2ac775828a1e0
BLAKE2b-256 checksum
How to use checksums
1c4acf8eb0f509a2dfb1c91cf02870dc29ba2edce84d65856234884a1c790f97
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 29, 2026.

Transparency log

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

Download URL samps-0.13.0-py3-none-any.whl
Size 36.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e88009f4fa3030bc9d86d78c49c43bd814059d54e8c31c3f38ae92ee32d54918
BLAKE2b-256 checksum
How to use checksums
824453c70acb2deba6b342ba7196c56eb85e236092bccd746abe373e555d09ec
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 29, 2026.

Transparency log

Security for samps 0.13.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.13.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 29, 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