Skip to main content

pylibftdi

pylibftdi is a minimal Pythonic interface to FTDI devices using libftdi.

Features:
  • No dependencies beyond standard library and a libftdi install.

  • Supports parallel and serial devices

  • Support for multiple devices

  • File-like interface wherever appropriate

  • Cross-platform

Usage

The primary interface is the Device class in the pylibftdi package; this gives serial access on relevant FTDI devices (e.g. the UM232R), providing a file-like interface (read, write). Baudrate is controlled with the baudrate property.

If a Device instance is created with mode='t' (text mode) then read() and write() can use the given encoding (defaulting to latin-1). This allows easier integration with passing unicode strings between devices.

Multiple devices are supported by passing the desired device serial number (as a string) in the device_id parameter - this is the first parameter in both Device() and BitBangDevice() constructors. Alternatively the device ‘description’ can be given, and an attempt will be made to match this if matching by serial number fails.

Examples

>>> from pylibftdi import Device
>>>
>>> with Device(mode='t') as dev:
...     dev.baudrate = 115200
...     dev.write('Hello World')

The pylibftdi.BitBangDevice wrapper provides access to the parallel IO mode of operation through the port and direction properties. These provide an 8 bit IO port including all the relevant bit operations to make things simple.

>>> from pylibftdi import BitBangDevice
>>>
>>> with BitBangDevice('FTE00P4L') as bb:
...     bb.direction = 0x0F  # four LSB are output(1), four MSB are input(0)
...     bb.port |= 2         # set bit 1
...     bb.port &= 0xFE      # clear bit 0

There is support for a number of external devices and protocols, including interfacing with HD44780 LCDs using the 4-bit interface.

History & Motivation

This package is the result of various bits of work using FTDI’s devices, primarily for controlling external devices. Some of this is documented on the codedstructure blog, codedstructure.blogspot.com

Several other open-source Python FTDI wrappers exist, and each may be best for some projects. Some aim at closely wrapping the libftdi interface, others use FTDI’s own D2XX driver (ftd2xx) or talk directly to USB via libusb or similar (such as pyftdi).

The aim for pylibftdi is to work with libftdi, but to provide a high-level Pythonic interface. Various wrappers and utility functions are also part of the distribution; following Python’s batteries included approach, there are various interesting devices supported out-of-the-box - or at least there will be soon!

Plans

  • Add more examples: SPI devices, knight-rider effects, input devices, MIDI…

  • Perhaps add support for D2XX driver, though the name then becomes a slight liability ;)

License

Copyright (c) 2010-2026 Ben Bass <benbass@codedstructure.net>

pylibftdi is released under the MIT licence; see the file “LICENSE.txt” for information.

All trademarks referenced herein are property of their respective holders. libFTDI itself is developed by Intra2net AG. No association with Intra2net is claimed or implied, but I have found their library helpful and had fun with it…

Metadata

Release files for pylibftdi 0.25.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 pylibftdi 0.25.0
File Size Uploaded Provenance Actions
pylibftdi-0.25.0.tar.gz 32.9 kB Without provenance Details for pylibftdi-0.25.0.tar.gz

Built distribution (wheel)

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

Total release size: 66.1 kB

Release files / pylibftdi-0.25.0.tar.gz

Download URL pylibftdi-0.25.0.tar.gz
Size 32.9 kB
Tags Source
SHA-256 checksum
How to use checksums
011361fdd9efdc52d8d3feda3a7917683f1368e7fb5c59ad550efd6519b03f99
BLAKE2b-256 checksum
How to use checksums
125bddac3684466db288c7c2113fb2eaa89f663e088159123084e5b9ce3efcd6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release files / pylibftdi-0.25.0-py3-none-any.whl

Download URL pylibftdi-0.25.0-py3-none-any.whl
Size 33.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bf346442c6ae61ae90e2b4d219717aa8c135ca3faa96bd273f8cff219fbcbc57
BLAKE2b-256 checksum
How to use checksums
f707c766e64c9dca3269eacd24471624cf64f5c8769de3ada3af8d66fadc8cc3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.13.6 {"installer":{"name":"uv","version":"0.13.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Security for pylibftdi 0.25.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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

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.

Release history Release notifications | RSS feed

This release

0.25.0 This release

2 release files No provenance

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