Skip to main content

hhart

HHART's Python package and CLI. Stdlib only.

Developed in HHART, where issues and PRs go. HHART-Python is a read-only mirror of this folder.

Install

uv pip install hhart

Or build it with colcon (it has a package.xml) and run ros2 run hhart hhart. ROS 2 Jazzy only for now.

Modules

Module
hhart.ports TelemetrySource, Publisher and Clock protocols
hhart.clock SystemClock, and ManualClock for tests
hhart.arbitration Operator latch (admit), deadman (deadman) and Arbiter
hhart.rate_limit, hhart.retry Rate limiting and reconnecting for telemetry sources
hhart.websocket_publisher Fan-out to WebSocket clients
hhart.contract Contract registry, describe, generated spec and golden fixture
hhart.operator serve, one operator WebSocket connection
hhart.cli hhart new, check and contract
hhart.testing.fitness Rule checks for a robot's tests

Checks

The checks parse source with ast, so nothing is imported. Each raises AssertionError listing the offending files.

Check Fails when Rule
assert_core_is_pure(core) the core imports a device, transport or middleware library 2
assert_dependencies_point_inward(package) an inner layer imports an outer one (core, adapters, apps) 2
assert_middleware_confined(package, "rclpy", to=adapter) rclpy is imported outside its adapter 2, 4
assert_no_load_time_imports(package, ROS_PACKAGES) ROS is imported at module level 9
assert_roots_reach_the_core(apps, core) an entry point never uses the core 2
assert_roots_have_no_import_effects(apps) importing an entry point parses args, sets up logging or installs signal handlers 9
assert_literals_confined(package, literals, to=module) a wire format or message type appears outside the module that owns it 4, 6

check_all(package) runs the default set:

from hhart.testing import fitness


def test_architecture():
    failed = [f"Rule {rule}, {check}: {error}" for rule, check, error in fitness.check_all("myrobot") if error]
    assert not failed, "\n".join(failed)

The checks expect a package split into core, adapters and apps.

Contract

from dataclasses import dataclass

from hhart.contract import IN, Contract

CONTRACT = Contract(version="0.1.0")


@CONTRACT.message("drive", direction=IN)
@dataclass(frozen=True)
class Drive:
    direction: str
    pct: int


CONTRACT.passthrough("battery", topic="/battery_state", ros_type="sensor_msgs/msg/BatteryState",
                     fields={"voltage_v": "voltage"}, units={"voltage_v": "V"}, max_hz=1.0)

encode and decode handle tier 1 messages, passthrough_payload tier 2. describe() is sent to the UI on connect. markdown() and examples() give CONTRACT.md and the golden fixture.

Tests

uv venv && uv pip install -e ".[dev]"
pytest

Licence

Licensed under the Apache License 2.0 (Apache-2.0), like the rest of HHART. See NOTICE.

Metadata

Release files for hhart 0.1.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 hhart 0.1.0
File Size Uploaded Provenance Actions
hhart-0.1.0.tar.gz 26.8 kB With provenance Details for hhart-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 112.3 kB

Release files / hhart-0.1.0.tar.gz

Download URL hhart-0.1.0.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
af107846abe4be9ac635a7b59bb53f720eb4d40b9306388d7b83a922f751bb81
BLAKE2b-256 checksum
How to use checksums
bd4c1dc06481ba3e4e06262f220dc87821d343d037f1a4790d23777991241399
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Release files / hhart-0.1.0-py3-none-any.whl

Download URL hhart-0.1.0-py3-none-any.whl
Size 85.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c8eecff81d7ff09a632abe4d68250fbe638e556ae0f20775a8e828b1aa23179d
BLAKE2b-256 checksum
How to use checksums
02e7ebdd4c91707d9d1608fa655d4d1bfd867f122884222c556293e4b21e8e4c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

Security for hhart 0.1.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.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hhart-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 8, 2026.

Transparency log

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.1.0 This release

2 release files Full 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