Skip to main content

Python bindings for FIRM Client using Rust

Project description

FIRM-Client

A modular Rust library for parsing FIRM data packets, with bindings for Python and WebAssembly.

Project Structure

The project is organized as a Cargo workspace with the following crates:

  • firm_core: The core no_std crate containing the packet parser, CRC logic, and data structures. This is the foundation for all other crates and can be used in embedded environments.
  • firm_rust: A high-level Rust API that uses serialport to read from a serial device and provides a threaded client for receiving packets.
  • firm_python: Python bindings for the Rust client.
  • firm_wasm: WebAssembly bindings and TypeScript code for using the parser in web applications.

Philosophy

The goal of FIRM-Client is to provide a single, efficient, and correct implementation of the FIRM parser that can be used across different ecosystems (Rust, Python, Web/JS, Embedded). By centralizing the parsing logic in firm_core, we ensure consistency and reduce code duplication.

Building

Prerequisites

  • Rust (latest stable)
  • Python 3.10+ (for Python bindings)
  • maturin (for building Python wheels)
  • wasm-pack (for building WASM)
  • Node.js/npm (for TypeScript)

Build Instructions

We assume that you are using a Unix-like environment (Linux or macOS).

Windows users may need to adapt some commands (we will mention where this is the case), or use WSL (Windows Subsystem for Linux) for best compatibility.

Make sure you have Cargo and uv installed.

You would also need npm if you want to test the web/TypeScript bindings. Install it and Node.js here: https://nodejs.org/en/download/

  1. Build all Rust crates:

    cargo build
    
  2. Build Python bindings:

    cargo build -p firm_python
    uv sync
    # or to build a wheel
    uv run maturin build --release
    
  3. Build WASM/TypeScript:

    cd firm_wasm
    npm install
    npm run build
    

Usage

Rust

Add firm_rust to your Cargo.toml.

use firm_rust::FirmClient;
use std::{thread, time::Duration};

fn main() {
    let mut client = FIRMClient::new("/dev/ttyUSB0", 2_000_000, 0.1);
    client.start();

    loop {
        while let Ok(packet) = client.get_packets(Some(Duration::from_millis(100))) {
            println!("{:#?}", packet);
        }
    }
}

Python

You can install the library via pip (once published) or build from source.

pip install firm-client

This library supports Python 3.10 and above, including Python 3.14 free threaded.

from firm_client import FIRMClient
import time

# Using context manager (automatically starts and stops)
with FIRMClient("/dev/ttyUSB0", baud_rate=2_000_000, timeout=0.1) as client:
    client.get_data_packets(block=True)  # Clear initial packets
    client.zero_out_pressure_altitude()
    while True:
        packets = client.get_data_packets()
        for packet in packets:
            print(packet.timestamp_seconds, packet.accel_x_meters_per_s2)

Web (TypeScript)

todo: Add usage example.

Publishing

This is mostly for maintainers, but here are the steps to publish each crate to their respective package registries:

Rust API (crates.io)

todo (idk actually know yet)

Python Bindings (PyPI)

We need to to first build wheels for each platform, right now the workflow is to do this locally and then upload to PyPI. At the minimum, we build for Linux x86_64 and aarch64 for python versions 3.10+, including free threaded wheels.

  1. We should always bump the version in firm_python/Cargo.toml and pyproject.toml before publishing. Make sure they match exactly.

  2. Build the wheels (.sh files can only run on Unix-like systems, so Windows users may simply open the file and run the commands manually):

./compile.sh

This will create wheels in the target/wheels directory, for Python versions 3.10 to 3.14, for both x86_64 and aarch64.

  1. Make sure you also have a source distribution:
uv run maturin sdist
  1. We will use uv to publish these wheels to PyPI. Make sure you are part of the HPRC organization on PyPI, so you have access to the project and can publish new versions.
uv publish target/wheels/*

This will ask for PyPI credentials, make sure you get the token from the website.

TypeScript Package (npm)

  1. Login to npm

npm login

  1. Publish it

npm publish

(Ensure the version in package.json is bumped before publishing.)

License

Licensed under the MIT License. See LICENSE file for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

firm_client-0.1.2.tar.gz (16.5 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

firm_client-0.1.2-cp314-cp314t-manylinux_2_34_x86_64.whl (316.0 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp314-cp314t-manylinux_2_31_aarch64.whl (279.5 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ ARM64

firm_client-0.1.2-cp314-cp314-win_amd64.whl (256.3 kB view details)

Uploaded CPython 3.14Windows x86-64

firm_client-0.1.2-cp314-cp314-manylinux_2_34_x86_64.whl (316.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp314-cp314-manylinux_2_31_aarch64.whl (280.5 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

firm_client-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl (317.4 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp313-cp313-manylinux_2_31_aarch64.whl (280.7 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

firm_client-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl (317.6 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp312-cp312-manylinux_2_31_aarch64.whl (281.3 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

firm_client-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl (317.5 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp311-cp311-manylinux_2_31_aarch64.whl (281.7 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

firm_client-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl (317.3 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.34+ x86-64

firm_client-0.1.2-cp310-cp310-manylinux_2_31_aarch64.whl (281.5 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ ARM64

File details

Details for the file firm_client-0.1.2.tar.gz.

File metadata

  • Download URL: firm_client-0.1.2.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2.tar.gz
Algorithm Hash digest
SHA256 e8c525f13dab03dac36d5c212abeb686b7bfd061024fdfd388adebd036e6589a
MD5 e8f8893b002a4a3d4776f736ed6ce1a1
BLAKE2b-256 a3ee4b38480a031afea2f548252a6f975a7549b63ef2d58458f5d2e4e4927551

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp314-cp314t-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp314-cp314t-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 316.0 kB
  • Tags: CPython 3.14t, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp314-cp314t-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7dff0234e4f5f0c5b0b1d415ddf2295fde0ed99f03f927905a3f91e3f98f995c
MD5 231126765ece0321997c61952ab76de5
BLAKE2b-256 a293f32e51eb3fcf9fa97892bcda466119fd4de2ec1e77940fbdba3c35d3f8c6

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp314-cp314t-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp314-cp314t-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 279.5 kB
  • Tags: CPython 3.14t, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp314-cp314t-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 693e058aed3102c31cf46b77f30926e91989a88588e5b285483a7abf053aba64
MD5 c707acc766ffc86dd39c4ef0b5a2c31f
BLAKE2b-256 72d5dd5408c8fe84a666544ea5fe6a3910b7c23733c91111d4a352ff639e803b

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp314-cp314-win_amd64.whl.

File metadata

File hashes

Hashes for firm_client-0.1.2-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 acfef8bec0e3b1d91835d9ca182820f1a4119f87bc4640a5781ef6a9523c14cf
MD5 04486a7cb2e46f1c51e6f83abf680683
BLAKE2b-256 751b0ba9714ff339cebdf3a9542a51583e4a013a4b3bd7264c48a5c83da0d850

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp314-cp314-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp314-cp314-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 316.5 kB
  • Tags: CPython 3.14, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp314-cp314-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 e0d6cd15a25b5fc545ef463c7a2a44ce082ae0a52ef3ce41aeb176b841277c29
MD5 bbe13858aff733407467ff106e8d6010
BLAKE2b-256 6a38019b6caea84ade357966894d86a488942bce699ee19857187895813dff82

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp314-cp314-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp314-cp314-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 280.5 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 7fbade0ca2853ee03c01323d083a99b8e0695eac982b799457949805a5a5568c
MD5 4c10181337ef82c6124996ceefde85f4
BLAKE2b-256 03eb5ac4fbe58ed4b8aa504d34ddfdc99b61fe0478514d5d980acd9bb1274947

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 317.4 kB
  • Tags: CPython 3.13, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp313-cp313-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 08b440c2136cac4df2721947771dc1b1e81756a8784de0747ab343cc763c29f5
MD5 d3059538f46c398de0564d6535d44e90
BLAKE2b-256 ad5a036208c7004f81c6d1b64fb527eb37feea0bfbd4d8c11b3f4fe40a40c943

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp313-cp313-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp313-cp313-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 280.7 kB
  • Tags: CPython 3.13, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 8f3f23cf7a3f525dc64d8ac2b5052efc8294f527d85a55cd2017660c7518ab12
MD5 21b2405673bbdaefe703ac0e7a334677
BLAKE2b-256 6d5ea6d864911667c79fb58bf442c3f2ffd271abde35e89aa6f8c531e966a58f

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 317.6 kB
  • Tags: CPython 3.12, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp312-cp312-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 d60b34e03f05875a6f1d366b30e1632086d5bdce13a75ea860e0f95450e33398
MD5 29abf23ca97d25ea42c33fcf2769a138
BLAKE2b-256 09828e08639a2c5f0483585500571fad07cd991ceb6acec79174380c73752ded

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp312-cp312-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp312-cp312-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 281.3 kB
  • Tags: CPython 3.12, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 c855fc77fe7dd6c4975dddf2441d3d08bc9be0cbff74acb9528c321b2c8c0f94
MD5 07e0475116096b14b613396960ac5214
BLAKE2b-256 6090f953903d5ff1fdc8e8f1ab857485841f8047ea50cb94190f520a72b22505

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 317.5 kB
  • Tags: CPython 3.11, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp311-cp311-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 ee83ac5c0dcfb83a3a76d305dc0d8eea3d2b48bbf45a284fe01497731e8a354d
MD5 ff752177893444fdbee0d147e0650c74
BLAKE2b-256 3524206e4e307fb28a2457cbab47169e9a9dacac9e63bb151b66eb081054f3f4

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp311-cp311-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp311-cp311-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 281.7 kB
  • Tags: CPython 3.11, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 7ddf6bddcd3de8443a07b96601e3d37280434818d00f6139e8e70df5461ffe01
MD5 112c7bce1fa0bdecea92579db7d9d5ca
BLAKE2b-256 0215937cfdc9e2d8b37cc5c705e606760d172045f3254205ac6b7e59c92e8271

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
  • Upload date:
  • Size: 317.3 kB
  • Tags: CPython 3.10, manylinux: glibc 2.34+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp310-cp310-manylinux_2_34_x86_64.whl
Algorithm Hash digest
SHA256 7c3759b3eaaa6e15b9a7e94f1e9e6857d893f6153a257f4ee1e226d6899620cc
MD5 5e45d0cf6558808eba2b588b914953a3
BLAKE2b-256 87fb3586f4133101eb38c22c007299d1e13b8011619d30ab3f1a5b65747236c0

See more details on using hashes here.

File details

Details for the file firm_client-0.1.2-cp310-cp310-manylinux_2_31_aarch64.whl.

File metadata

  • Download URL: firm_client-0.1.2-cp310-cp310-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 281.5 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.16 {"installer":{"name":"uv","version":"0.9.16","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Arch Linux","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for firm_client-0.1.2-cp310-cp310-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 19bf2d5cac3ee5c697bc131dc62ba8433642f401e6e2aab7e2efc560f96063d0
MD5 acca3b9a21cab14e6bb0d74f0ebe8572
BLAKE2b-256 469ccc696b7f041417e0da6bd0c5603373a8f74696aee834ece33cf69cee8072

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page