Skip to main content

Hex Device Python Library

中文 | English

Overview

This library provides a simple interface for communicating with and controlling Hex devices. It uses Protocol Buffers for message serialization and WebSocket for real-time communication. The supported hardware list is as follows:

Prerequisites

  • Python 3.9 or higher
  • Anaconda Distribution (recommended for beginners) - includes Python, NumPy, and commonly used scientific computing packages

Installation

pip install hex_device

Clone the Repository (Development)

git clone --recurse-submodules https://github.com/hexfellow/hex_device_python.git

Quickstart

If you have already installed the library from PyPI using pip, please refer to Usage

Install protoc

  1. Install protoc from package manager (Recommended only for Debian13/Ubuntu24.04)

    sudo apt install protobuf-compiler
    
  2. Install protoc from Github Releases (Recommended Ubuntu22.04 and below)

    Just choose a suitable version and install it. Here below is an example of installing protoc-27.1.

    # For Linux x86_64
    wget https://github.com/protocolbuffers/protobuf/releases/download/v27.1/protoc-27.1-linux-x86_64.zip
    sudo unzip protoc-27.1-linux-x86_64.zip -d /usr/local
    rm protoc-27.1-linux-x86_64.zip
    
    # For Linux arm64
    wget https://github.com/protocolbuffers/protobuf/releases/download/v27.1/protoc-27.1-linux-aarch_64.zip
    sudo unzip protoc-27.1-linux-aarch_64.zip -d /usr/local
    rm protoc-27.1-linux-aarch_64.zip
    
    # Verify installation
    protoc --version # Should be or more than 3.21.12
    

Install hex_device

Compile Protocol Buffer messages:

mkdir ./hex_device/generated
protoc --proto_path=proto-public-api --python_out=hex_device/generated proto-public-api/*.proto && cp ./proto-public-api/version.py ./hex_device/generated/version.py

Option 1: Package Installation

To install the library in your Python environment:

python3 -m pip install .

Option 2: Direct Usage (No Installation)

If you prefer to run the library without installing it in your Python environment:

  1. Install dependencies:

    python3 -m pip install -r requirements.txt
    
  2. Add the library path to your script:

    import sys
    sys.path.insert(1, '<your project path>/hex_device_python')
    sys.path.insert(1, '<your project path>/hex_device_python/hex_device/generated')
    

Usage

  • The complete function interfaces can be found in our wiki. If you are new to the library, we strongly recommend skimming the available control interfaces first.
  • If you are using a robotic arm, you can refer to the docs for the controller port instructions.

Examples

Basic Usage

IPv4 connection:

python3 tests/main.py --url ws://0.0.0.0:8439

IPv6 connection:

python3 tests/main.py --url ws://[fe80::500d:96ff:fee1:d60b%3]:8439

Q&A

How do I connect using IPv6?

You can connect to our devices using IPv6, which enables direct connection without a router (e.g., using a single cable to connect the robot and PC).

Note: We assume you have basic knowledge about IPv6. If you don't, please use IPv4 instead. We will not explain IPv6 in detail.

Key points:

  • Without DHCP6, devices can still have a link-local address
  • To use link-local addresses, you must specify the zone ID of the interface using the % symbol
  • You can find the zone ID of the interface by running ip a

Example:

# Find the interface and zone ID
ip a

# Use the zone ID in the connection URL
ws://[fe80::500d:96ff:fee1:d60b%3]:8439

Why did a previously working software package stop working after a redeployment?

Please check the Change log to see if you are using cross-version software packages. Additionally, we recommend that you use a fixed software version after successful deployment to avoid code failures due to incompatible updates.

If I want to use newer software packages, how do I perform hardware upgrades?

Please contact our after-sales service, and we will provide hardware upgrade instructions based on the equipment you purchased.


Copyright © 2025-present Hexfellow Org

Metadata

Release files for hex-device 1.4.12

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hex-device 1.4.12
File Size Uploaded Provenance Actions
hex_device-1.4.12.tar.gz 97.9 kB Without provenance Details for hex_device-1.4.12.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hex-device 1.4.12
File Interpreter ABI Platform Actions
hex_device-1.4.12-py3-none-any.whl Python 3 none any Details for hex_device-1.4.12-py3-none-any.whl

Total release size: 190.3 kB

Release files / hex_device-1.4.12.tar.gz

Download URL hex_device-1.4.12.tar.gz
Size 97.9 kB
Tags Source
SHA-256 checksum
How to use checksums
f100898c657d16d989a36bdaa2e64ce30089cb26145957a20905822af9025877
BLAKE2b-256 checksum
How to use checksums
5f0ea89f50f83dbb9e096b9fbe35529ea6ed1c9dae8eb4eea6ae160669f91ced
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Release files / hex_device-1.4.12-py3-none-any.whl

Download URL hex_device-1.4.12-py3-none-any.whl
Size 92.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
bcf0a7f73fb7a9dedef3d7a3b5011962cebf08f7a02181890c302a924d563527
BLAKE2b-256 checksum
How to use checksums
51980074c7e4aca21b88d1d81aca90e00d4b647db6dc1ad2e23198942eaf8f5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.10.18

Security for hex-device 1.4.12

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

1.4.12 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