Skip to main content

A functional reactive platform used to process time-series streams. Provides support for backtest (simulation) and realtime time-series processing. Using a forward propagation graph with a microtask scheduler for the runtime engine.

Project description

hgraph

A functional reactive programming engine with a Python front-end.

This provides a DSL and runtime to support the computation of results over time, featuring a graph based directed acyclic dependency graph and the concept of time-series properties. The language is function-based, and promotes composition to extend behaviour.

Here is a simple example:

from hgraph import graph, evaluate_graph, GraphConfiguration, const, debug_print

@graph
def main():
    a = const(1)
    c = a + 2
    debug_print("a + 2", c)

evaluate_graph(main, GraphConfiguration())

Results in:

[1970-01-01 00:00:00.000385][1970-01-01 00:00:00.000001] a + 2: 3

See this for more information.

Development

The project is currently configured to make use of uv for dependency management. Take a look at the website to see how best to install the tool.

Here are some useful commands:

First, create a virtual environment in the project directory:

uv venv

Then use the following command to install the project and its dependencies:

# Install the project with all dependencies
uv pip install -e .

# Install with optional dependencies
uv pip install -e ".[docs,web,notebook]"

# Install with all optional dependencies
uv pip install -e ".[docs,web,notebook,test]"

PyCharm can make use of the virtual environment created by uv to setup the project.

Run Tests

# No Coverage
python -m pytest
# Generate Coverage Report
python -m pytest --cov=hgraph --cov-report=xml

Indexing with Context7 MCP

This repository includes a baseline configuration for Context7 MCP to improve code search and retrieval quality.

  • See docs/context7_indexing.md for guidance.
  • The root-level context7.yaml config sets sensible include/exclude rules, priorities, and summarization hints.

Packaging, CI, and Releases

This project uses scikit-build-core and cibuildwheel to build and publish cross-platform wheels, with uv as the package/venv manager.

  • Local build (PEP 517):

    # Build a wheel into dist/
    uv build -v
    # Optionally build sdist too
    uv build -v --sdist
    
  • Optional Conan (developer builds only):

    # Conan is not required for packaging but may be used in local builds
    uv tool install conan
    # Example of enabling Conan provider for a local build
    CMAKE_ARGS="-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake" uv build -v
    
  • macOS notes:

    • Wheels target Apple Silicon (arm64) and require a macOS deployment target high enough for libc++ floating-point to_chars used by std::format.
    • The build system enforces MACOSX_DEPLOYMENT_TARGET=15.0 (arm64) during Release Wheels and sets a default in CMake if unset.
    • You can override locally via:
      CMAKE_ARGS="-DCMAKE_OSX_DEPLOYMENT_TARGET=15.0 -DCMAKE_OSX_ARCHITECTURES=arm64" uv build -v
      
  • Windows notes:

    • Build uses MSVC (Visual Studio 2022, x64). No MinGW.
    • If stack traces via backward-cpp are enabled, Windows links Dbghelp and Imagehlp automatically.
  • Linux notes:

    • Release wheels are built inside manylinux containers; optional backward-cpp integrations are disabled there for portability.

CI summary

  • .github/workflows/ci.yml builds wheels on Linux/macOS/Windows for smoke validation, runs tests on Linux only (fast path), and repairs Linux wheels with auditwheel.
  • .github/workflows/release-wheels.yml builds publish-grade wheels with cibuildwheel (Linux manylinux, macOS arm64, Windows AMD64), builds an sdist, validates with twine, and publishes to PyPI via Trusted Publishing.

Releasing (tag-driven)

Releases are automated via GitHub Actions with PyPI Trusted Publishing.

Prerequisites:

  • Enable Trusted Publishing for this GitHub repository in the PyPI project settings (Project → Settings → Trusted Publishers). No API token is needed once OIDC is configured.
  • Ensure pyproject.toml [project].version matches the tag you plan to push (e.g., 0.4.112).

Steps:

# Update version in pyproject.toml to match your release
# Then tag and push the tag to trigger the release workflow

git tag -a v_0.4.112 -m "release 0.4.112"
git push origin v_0.4.112

The workflow will:

  • Build wheels for Linux (manylinux), macOS (arm64, macOS 15.0 target), and Windows (AMD64, MSVC)
  • Build an sdist
  • Validate with twine check
  • Publish all distributions to PyPI (skips existing files)

Artifacts are uploaded for inspection as part of the workflow run.

CLion configuration tips

  • Use the project venv Python for nanobind discovery:
    • CMake option: -DPython_EXECUTABLE=${PROJECT_ROOT}/.venv/bin/python
  • If you need Conan, use the preamble to ensure Python/nanobind are discovered first, then the Conan provider:
    • CMake option: -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=${PROJECT_ROOT}/conan_preamble.cmake;${PROJECT_ROOT}/conan_provider.cmake
  • Select the _hgraph target to build the extension.

Troubleshooting

  • Nanobind not found / Python ordering in CMake:
    • Pass -DPython_EXECUTABLE=... (or -DPython3_EXECUTABLE=...) and, if using Conan, use the conan_preamble.cmake before conan_provider.cmake.
  • I also find it helpful to perform an uv sync with at least --all-groups before setting up the cmake.

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

hgraph-0.5.20.tar.gz (5.4 MB view details)

Uploaded Source

Built Distributions

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

hgraph-0.5.20-cp312-abi3-win_amd64.whl (1.6 MB view details)

Uploaded CPython 3.12+Windows x86-64

hgraph-0.5.20-cp312-abi3-musllinux_1_2_x86_64.whl (2.2 MB view details)

Uploaded CPython 3.12+musllinux: musl 1.2+ x86-64

hgraph-0.5.20-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl (1.7 MB view details)

Uploaded CPython 3.12+manylinux: glibc 2.27+ x86-64manylinux: glibc 2.28+ x86-64

hgraph-0.5.20-cp312-abi3-macosx_15_0_arm64.whl (1.5 MB view details)

Uploaded CPython 3.12+macOS 15.0+ ARM64

File details

Details for the file hgraph-0.5.20.tar.gz.

File metadata

  • Download URL: hgraph-0.5.20.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hgraph-0.5.20.tar.gz
Algorithm Hash digest
SHA256 e07dc94d7aea9ec1b3791e8ab0827a86b0c7d88f5896bc55a3e78ec431938dc2
MD5 4b7fb46c03ff99e10942de8c42f9d421
BLAKE2b-256 30340047923a51e61ccce623feeda55af593ee01c9b249bbc03b2d810c14c998

See more details on using hashes here.

Provenance

The following attestation bundles were made for hgraph-0.5.20.tar.gz:

Publisher: release-wheels.yml on hhenson/hgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hgraph-0.5.20-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: hgraph-0.5.20-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 1.6 MB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for hgraph-0.5.20-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e82a6db2e541c3d51352122dd6c07e161e71042914002b32c00ac9f6c07097ce
MD5 a74ee387a87e6eff991bc37e0bdd209c
BLAKE2b-256 3cc9993b80df98e30d219fef5e0df6050665192fa741a8f81a6f3c7e5f512ca8

See more details on using hashes here.

Provenance

The following attestation bundles were made for hgraph-0.5.20-cp312-abi3-win_amd64.whl:

Publisher: release-wheels.yml on hhenson/hgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hgraph-0.5.20-cp312-abi3-musllinux_1_2_x86_64.whl.

File metadata

File hashes

Hashes for hgraph-0.5.20-cp312-abi3-musllinux_1_2_x86_64.whl
Algorithm Hash digest
SHA256 b0bbc21731f4d47feae83feb8cf5cb986a9bd33d87ed16c2031b87a167318f66
MD5 2c2a3d5f4a5e4912d97c7a4823f5a6e3
BLAKE2b-256 e5f9974653fc85c49d73682a72340b42d63726e594a52dbbaa6a775f548a569b

See more details on using hashes here.

Provenance

The following attestation bundles were made for hgraph-0.5.20-cp312-abi3-musllinux_1_2_x86_64.whl:

Publisher: release-wheels.yml on hhenson/hgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hgraph-0.5.20-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl.

File metadata

File hashes

Hashes for hgraph-0.5.20-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Algorithm Hash digest
SHA256 2f3956783322e303b5b9acb6146bdfbdd59209203cabdefcfea9804a58c5a3e6
MD5 8bbbdfbc2319d5b3b852f065b08e728e
BLAKE2b-256 97062f232758d6cf6f836c91bb2d6714033e1eb1ff6d9ace6d1dcbf6fc6254d4

See more details on using hashes here.

Provenance

The following attestation bundles were made for hgraph-0.5.20-cp312-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl:

Publisher: release-wheels.yml on hhenson/hgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file hgraph-0.5.20-cp312-abi3-macosx_15_0_arm64.whl.

File metadata

File hashes

Hashes for hgraph-0.5.20-cp312-abi3-macosx_15_0_arm64.whl
Algorithm Hash digest
SHA256 c96e9c5bef14d4b96cc75422247bfa6c409e4bc9f7c7f375cfdd2c0e8981f1f5
MD5 f7bf820750111a9839a78386713d329d
BLAKE2b-256 0f6ee8e37c70875a3bf7b2fea155c8c8dde4639c56804e56498668c51860d10c

See more details on using hashes here.

Provenance

The following attestation bundles were made for hgraph-0.5.20-cp312-abi3-macosx_15_0_arm64.whl:

Publisher: release-wheels.yml on hhenson/hgraph

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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