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.1

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.1
File Size Uploaded Provenance Actions
hhart-0.1.1.tar.gz 26.8 kB With provenance Details for hhart-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 112.2 kB

Release files / hhart-0.1.1.tar.gz

Download URL hhart-0.1.1.tar.gz
Size 26.8 kB
Tags Source
SHA-256 checksum
How to use checksums
36812c877c96e0583ca5c29209734ea28a963853a7fc559dc25a4ab3369b55a7
BLAKE2b-256 checksum
How to use checksums
7b53e2beb70347aec89c400f8271c9568dd0021981b99cb7a7f49a97825dd80b
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.1-py3-none-any.whl

Download URL hhart-0.1.1-py3-none-any.whl
Size 85.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5f79ef3eea186ebc8b4a66d7d9bfb7210e1c020d28f6cd8fd22d59b954c25321
BLAKE2b-256 checksum
How to use checksums
db2ddd63c7116150d6d7b7438b9b9a14cfbf95a9f3c8d4b8f588de8d906c73bd
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.1

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.1.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.1 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