Skip to content

pipe-works/pipeworks_ipc

Repository files navigation

pipeworks_ipc

CI codecov docs python license code style: black lint: ruff pre-commit

Reusable, deterministic IPC (Interpretive Provenance Chain) hashing utilities for Pipe-Works projects.

What this package provides

  • compute_payload_hash(payload_dict)
  • compute_system_prompt_hash(prompt_text)
  • compute_output_hash(output_text)
  • compute_ipc_id(input_hash, system_prompt_hash, model, temperature, max_tokens, seed)
  • payload_hash(payload_model) convenience wrapper for objects exposing model_dump()

The first release preserves Axis Descriptor Lab semantics so IPC values are reproducible across projects.

Python / pyenv

This project targets Python 3.12+.

pyenv install -s 3.12.8
pyenv local 3.12.8
python -V

Install

pip install -e .
pip install -e ".[dev]"
pip install -e ".[docs]"

Install in Other Projects (Before PyPI)

Use one of these approaches when pipeworks-ipc is not yet published to PyPI.

Local path (editable):

pip install -e /path/to/pipeworks_ipc

GitHub tag:

pip install "pipeworks-ipc @ git+https://github.com/pipe-works/pipeworks_ipc.git@v0.1.1"

GitHub commit SHA (strict reproducibility):

pip install "pipeworks-ipc @ git+https://github.com/pipe-works/pipeworks_ipc.git@<commit-sha>"

For consumer pyproject.toml dependencies before PyPI publication:

[project]
dependencies = [
  "pipeworks-ipc @ git+https://github.com/pipe-works/pipeworks_ipc.git@v0.1.1"
]

When to Publish to PyPI

Publish when all of these are true:

  • at least one consumer project uses pipeworks-ipc in production-like flow
  • IPC semantics are stable and deterministic tests are green
  • CI/docs/release automation are consistently passing
  • you want to stop relying on local paths and Git URL dependencies

Recommended progression:

  1. integrate in a consumer project and stabilize
  2. release to TestPyPI first
  3. release to PyPI

Pre-commit hooks

pre-commit install
pre-commit run --all-files

Test

pytest -v

Documentation

Build locally:

make -C docs html

Open:

docs/build/html/index.html

Example

from pipeworks_ipc.hashing import (
    compute_payload_hash,
    compute_system_prompt_hash,
    compute_output_hash,
    compute_ipc_id,
)

payload = {"seed": 42, "world_id": "pipeworks", "policy_hash": "abc", "axes": {}}
input_hash = compute_payload_hash(payload)
prompt_hash = compute_system_prompt_hash("You are ornamental.")
output_hash = compute_output_hash("A weathered figure stands.")
ipc_id = compute_ipc_id(
    input_hash=input_hash,
    system_prompt_hash=prompt_hash,
    model="gemma2:2b",
    temperature=0.2,
    max_tokens=120,
    seed=42,
)

About

A composite SHA-256 fingerprint of every variable that influences a generation, implemented as a chain of individual hashes combined into a single identifier.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages