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_typescript: 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_typescript
    npm install
    npm run clean
    npm run build
    
    # For testing the code with examples/index.html
    npx serve .
    

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.raw_acceleration_x_gs)

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. Always bump the version in firm_python/Cargo.toml before publishing.

  2. Build the wheels

# If you're on Linux
./compile.sh

# If you're on Windows
.\compile.ps1

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. Always bump the version in firm_typescript/Cargo.toml and package.json before publishing. Make sure they match.

  2. 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-1.0.1.tar.gz (47.9 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-1.0.1-cp314-cp314t-win_amd64.whl (276.6 kB view details)

Uploaded CPython 3.14tWindows x86-64

firm_client-1.0.1-cp314-cp314t-manylinux_2_31_aarch64.whl (355.3 kB view details)

Uploaded CPython 3.14tmanylinux: glibc 2.31+ ARM64

firm_client-1.0.1-cp314-cp314-win_amd64.whl (275.8 kB view details)

Uploaded CPython 3.14Windows x86-64

firm_client-1.0.1-cp314-cp314-manylinux_2_31_x86_64.whl (436.3 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ x86-64

firm_client-1.0.1-cp314-cp314-manylinux_2_31_aarch64.whl (357.1 kB view details)

Uploaded CPython 3.14manylinux: glibc 2.31+ ARM64

firm_client-1.0.1-cp313-cp313-win_amd64.whl (277.5 kB view details)

Uploaded CPython 3.13Windows x86-64

firm_client-1.0.1-cp313-cp313-manylinux_2_31_aarch64.whl (358.1 kB view details)

Uploaded CPython 3.13manylinux: glibc 2.31+ ARM64

firm_client-1.0.1-cp312-cp312-win_amd64.whl (277.6 kB view details)

Uploaded CPython 3.12Windows x86-64

firm_client-1.0.1-cp312-cp312-manylinux_2_31_aarch64.whl (358.5 kB view details)

Uploaded CPython 3.12manylinux: glibc 2.31+ ARM64

firm_client-1.0.1-cp311-cp311-win_amd64.whl (275.1 kB view details)

Uploaded CPython 3.11Windows x86-64

firm_client-1.0.1-cp311-cp311-manylinux_2_31_aarch64.whl (356.8 kB view details)

Uploaded CPython 3.11manylinux: glibc 2.31+ ARM64

firm_client-1.0.1-cp310-cp310-win_amd64.whl (274.3 kB view details)

Uploaded CPython 3.10Windows x86-64

firm_client-1.0.1-cp310-cp310-manylinux_2_31_aarch64.whl (356.7 kB view details)

Uploaded CPython 3.10manylinux: glibc 2.31+ ARM64

File details

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

File metadata

  • Download URL: firm_client-1.0.1.tar.gz
  • Upload date:
  • Size: 47.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1.tar.gz
Algorithm Hash digest
SHA256 bf8721b11c43984c2f24ff40cf428aa2ee9b9baed2b46270be2cd04575376d94
MD5 5bb2a45881e57008fec0ae80e8e57526
BLAKE2b-256 d9c1f9fd56439cadb34199af9f922933d7691ad391322d71f0823b5747d4b107

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp314-cp314t-win_amd64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp314-cp314t-win_amd64.whl
  • Upload date:
  • Size: 276.6 kB
  • Tags: CPython 3.14t, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp314-cp314t-win_amd64.whl
Algorithm Hash digest
SHA256 e3d6ef0defea983c5faf7353af01b4215ac9b2052906cf6cadf38b0144ad80dc
MD5 ec1bed5884d1f0ec8471ce429e90bc59
BLAKE2b-256 8ff873dd4cdc7514a469db3878db46bea81991a9b2df4a8936cd154544bb9942

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp314-cp314t-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 355.3 kB
  • Tags: CPython 3.14t, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp314-cp314t-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 383c949ac207e4904645ba5e415241d0a34657b31ae06088ee08d40db3d747ff
MD5 173fd85bc3996ca1019cd84ad2954035
BLAKE2b-256 17328430ba87fd9ddae05684a9d923256fbc6cef1b1110d3e00671b8a70cd8a2

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp314-cp314-win_amd64.whl
  • Upload date:
  • Size: 275.8 kB
  • Tags: CPython 3.14, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp314-cp314-win_amd64.whl
Algorithm Hash digest
SHA256 a84f4a3eeb86af7e6ca10a151a04a07103ee38d38728dc4da5519eedfc96eedf
MD5 3a737a8fc4e8d13f80f2ffde7fb85a5e
BLAKE2b-256 c204e2ec282a5572c044d5c27098a90f520ff78a2c20c3068bc47fa41c7ce837

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp314-cp314-manylinux_2_31_x86_64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp314-cp314-manylinux_2_31_x86_64.whl
  • Upload date:
  • Size: 436.3 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp314-cp314-manylinux_2_31_x86_64.whl
Algorithm Hash digest
SHA256 6832e7c49bf5a165c1b0bbc261dacaa900d24a3d157394046823cd06485c632f
MD5 ddb35bed8471627fa917b479297fd06a
BLAKE2b-256 7b291f6520a9703e1a756f19be349ab2d03649d1fb97020f4e4995a1f5de2b81

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp314-cp314-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 357.1 kB
  • Tags: CPython 3.14, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp314-cp314-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 332bb702a6064380be2d272f3ecd2c31993738bcae55f629dd95ba9a6e99cd0c
MD5 ac11ddc1a8bacff601c804451d08a375
BLAKE2b-256 70a73f8b6061eb30debdef8f6997a277ccdffea82ea9e6dc49c8b3f703c91852

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 277.5 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 4fc28e6718b60e23415f35b50be119ba2e0ee781eeb2b870f558966f3f3b38a0
MD5 a1063712b5166ab6a9def6d71572c336
BLAKE2b-256 1c3a52943a43219e194e381edaa60bd79d63a7a9a6d1d7c2d1b6b4b9ddb9f40e

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp313-cp313-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 358.1 kB
  • Tags: CPython 3.13, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp313-cp313-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 ea2ddaa1081f8faaf3ee777924399e761d592350e4f534548e68c8056d837b44
MD5 bbb8d963dedc8bb3a6275e55f136d574
BLAKE2b-256 10f642bc4add8a008ca3e9f7476271c202ac25a43acb095add0f20eeebe23213

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 277.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 feb5511b69cbbe2ea19ddd3ce05e2497c062f9eb6be93e4665d5540faaacb33e
MD5 daabfd4b008c1d86bbcb69408dd37ca1
BLAKE2b-256 f48a4503fb833cd0fa03ca8626ebf5957ddb9bf49aa2844321ae141caa7a705b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp312-cp312-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 358.5 kB
  • Tags: CPython 3.12, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp312-cp312-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 55c74996c56fb041ed471feb307a4c5277d2cbb9988a7497f9ac2d3d2d2a5679
MD5 4b0100c2a503cc6ee1818981aabb9c5a
BLAKE2b-256 b8c1791cdd7fd36fe5a42d491b4d2a86a51ce6b3accca625dcca6b50e62e65d8

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp311-cp311-win_amd64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp311-cp311-win_amd64.whl
  • Upload date:
  • Size: 275.1 kB
  • Tags: CPython 3.11, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp311-cp311-win_amd64.whl
Algorithm Hash digest
SHA256 32dc5170c48aadacf1122453090cd63dd1eae002f414d911a943bb7b2e9aba4d
MD5 ca874544aab3057c811f884d54f9a507
BLAKE2b-256 3e75a2ac1cd2c56da550c43c29ed3af605a464ab24bb895f6f86bab910e2e073

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp311-cp311-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 356.8 kB
  • Tags: CPython 3.11, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp311-cp311-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 f8bbe6a6a0f90de18507c484ef7891aae3fbfb4392409432201a58aa78db743a
MD5 196d7610ed12e9f9eef5340dad60693e
BLAKE2b-256 43b193d8aabc7c0543a3dea90e991320a801f3ddc8eeaf32713ba675df52ecee

See more details on using hashes here.

File details

Details for the file firm_client-1.0.1-cp310-cp310-win_amd64.whl.

File metadata

  • Download URL: firm_client-1.0.1-cp310-cp310-win_amd64.whl
  • Upload date:
  • Size: 274.3 kB
  • Tags: CPython 3.10, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp310-cp310-win_amd64.whl
Algorithm Hash digest
SHA256 c1f841b947df4567d46954148d5ae79fbf111a041a676fb747b2c9a08f8eba9e
MD5 84b64ea7ee0db645f96a06cbf6836e3f
BLAKE2b-256 6e5bf94f1620b17d9ba7f56c97283dfc0aef8ae707705a8597c71240abc2ac7c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: firm_client-1.0.1-cp310-cp310-manylinux_2_31_aarch64.whl
  • Upload date:
  • Size: 356.7 kB
  • Tags: CPython 3.10, manylinux: glibc 2.31+ ARM64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.28 {"installer":{"name":"uv","version":"0.9.28","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":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-1.0.1-cp310-cp310-manylinux_2_31_aarch64.whl
Algorithm Hash digest
SHA256 67cb65f9713a17050409219acb8d1c6eefb6ac1a079954eccf5b4fda84fb3b8a
MD5 e756b68004ca58957dcfd4b6ac66be74
BLAKE2b-256 141f1cfe0babe5553616e3e5e9d9c9f9fbc40953687011dfba7b338d70189c19

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