skillfed

spidev

Python bindings for Linux SPI access through spidev

spidev v3.8 121.5K downloads/30d#11,978 on PyPI480
Permissive license MIT AGING released

What it is and what it does

Spidev is a thin Python wrapper around the Linux kernel's spidev userspace API for controlling SPI (Serial Peripheral Interface) devices. It allows you to open a device file (typically /dev/spidev0.0), configure SPI parameters like clock speed and mode, and then read from or write to connected hardware. The package handles the low-level ioctl calls needed to communicate with the kernel driver, abstracting away the C API details.

The module is used primarily on embedded Linux systems—Raspberry Pi, BeagleBone, and similar platforms—where you need to talk to SPI-connected peripherals like sensors, displays, or memory chips. It supports configurable settings (speed, polarity, phase, chip-select behavior) and provides both simple read/write operations and full duplex transfers. The package has no runtime dependencies beyond the Linux kernel and spidev driver itself.

Use it for:

  • Control SPI-connected displays or LED matrices on a Raspberry Pi or similar embedded board.
  • Read sensor data from SPI-based accelerometers, temperature sensors, or analog-to-digital converters.
  • Interface with SPI flash memory chips or SD card controllers for embedded storage access.
  • Communicate with external SPI-connected microcontrollers or FPGAs in a larger embedded system.
  • Prototype hardware interfaces in Python without writing C kernel modules or using lower-level system calls directly.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Provides Python bindings to interact with SPI devices on Linux systems through the spidev kernel driver, allowing user-space programs to read from and write to SPI hardware.

Yes, if you are developing on Linux with SPI hardware and need straightforward Python access to it. The package is stable, permissively licensed, and has no known vulnerabilities. Install friction is moderate due to platform specificity, and maintenance is aging but not abandoned. Not suitable for non-Linux systems or projects requiring active feature development.

Install

spidev on PyPI

pip

pip install spidev

uv

uv add spidev

poetry

poetry add spidev

Installing spidev

Before you install

Medium install friction due to platform-specific wheel availability (ARM Linux only in the evidence shown). The package is in aging maintenance status with a last commit in December 2025, but carries production-stable classification and no known vulnerabilities. Suitable for stable embedded projects but not actively developed.

License in practice

MIT license is permissive and imposes no significant restrictions on use, modification, or distribution in your own projects.

Quickstart

import spidev

spi = spidev.SpiDev()
spi.open_path("/dev/spidev0.0")
spi.max_speed_hz = 5000
spi.mode = 0b01
to_send = [0x01, 0x02, 0x03]
response = spi.xfer(to_send)
spi.close()

Requires Linux kernel with spidev driver enabled and access to /dev/spidev* device files; typically runs on embedded Linux systems (Raspberry Pi, BeagleBone, etc.) or systems with SPI hardware controllers.

Verify before relying

  • Whether the package supports modern Python versions beyond what the classifiers indicate (Python 2.6, 2.7, 3 are listed but no specific 3.x versions stated).
  • Current state of active maintenance and whether aging status reflects planned long-term support or de facto abandonment.

Package facts

License MIT (permissive)
Python support not specified
Install friction medium — platform-specific wheel
Runtime dependencies none
Maintenance aging — 333 days since the last release
Last repo commit
First released
Downloads 121,457/month — #11,978 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: spidev-3.8-cp39-cp39-linux_armv7l.whl

Development Status :: 5 - Production/StableIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseOperating System :: POSIX :: LinuxProgramming Language :: Python :: 2.6Programming Language :: Python :: 2.7Programming Language :: Python :: 3Topic :: Software DevelopmentTopic :: System :: HardwareTopic :: System :: Hardware :: Hardware Drivers

Tags

SPI device communication pythonlinux spidev kernel driverserial peripheral interface pythonembedded hardware SPI controlraspberry pi SPI accessspidev linux userspaceSPI bus python interface
embedded-linuxhardware-interfacespi-protocol

More Software Development packages