Skip to main content

reconcilekit

PyPI

A tiny, stateless fetch-diff-apply reconciliation kernel — the pattern a fleet-wide config tool repeats for every resource it manages, with none of the domain specifics.

There is no state file, no backend, no daemon. Each run reads live state, compares it to what you want, and either reports the plan or applies it.

The pattern

  1. Enumerate targets — anything with a name.
  2. Fetch each target's current state.
  3. Compare to the desired state: already there? partly blocked?
  4. Dry-run → report the plan, or apply → mutate and report the outcome.
  5. Classify into Status (OK, UNCHANGED, LIMITED, LIMITED_UNCHANGED, FAILED).
  6. Run the fleet in bounded parallel, isolating per-target failures and raising them together at the end.

API

Full API reference, generated from the docstrings: hugoh.github.io/fleet-tools/reconcilekit (rebuilt on every push that touches this package -- see .github/workflows/docs.yml).

Example

import asyncio
from dataclasses import dataclass

from reconcilekit import (
    Result,
    Status,
    classify_status,
    result_line,
    run_parallel,
    run_reconcile,
)


@dataclass
class File:
    name: str
    path: str
    want: str


def make_worker(dry_run: bool):
    async def worker(f: File) -> Result[File]:
        async def fetch() -> str:
            return f.path_text()  # read current contents

        def plan(current: str) -> Result[File]:
            status = classify_status(
                at_target=current == f.want, changed=current != f.want
            )
            return Result(
                f,
                result_line(
                    f.name, "would rewrite" if current != f.want else "ok", status
                ),
                status,
            )

        async def apply(current: str) -> Result[File]:
            if current != f.want:
                f.write(f.want)
            status = classify_status(at_target=True, changed=current != f.want)
            return Result(
                f,
                result_line(f.name, "written" if current != f.want else "ok", status),
                status,
            )

        return await run_reconcile(
            dry_run=dry_run, fetch=fetch, plan_result=plan, apply_result=apply
        )

    return worker


asyncio.run(run_parallel(files, make_worker(dry_run=True)))

Consumers

repo-admin/ (in this repo) uses it for every account-wide GitHub sync command, consumed as a uv workspace member there.

Metadata

Release files for reconcilekit 0.5.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 reconcilekit 0.5.0
File Size Uploaded
reconcilekit-0.5.0.tar.gz 10.4 kB Details

Built distribution (wheel)

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

Total release size: 20.2 kB

Release files / reconcilekit-0.5.0.tar.gz

Download URL reconcilekit-0.5.0.tar.gz
Size 10.4 kB
Tags Source
SHA-256 checksum
How to use checksums
4db49422604737ae14e1176fb553a5a3c9fa9f889a08e26078767d3f4e50c2e8
BLAKE2b-256 checksum
How to use checksums
4fc67caf65ad110fd93eea97440a3f3bc9cbf20d65afd4ebfe4f0ed5b25a7775
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release files / reconcilekit-0.5.0-py3-none-any.whl

Download URL reconcilekit-0.5.0-py3-none-any.whl
Size 9.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
58521ae22ae329c03f21dabf94cbe6c8fba2de986b4ce1e62d0a5eac94d6ff1b
BLAKE2b-256 checksum
How to use checksums
f299499c3eacf4b9c68f7e37b42936c1fdca37304b1479ea05e28b8506b6fbf0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Sep 9, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.1

2 release files

0.3.0

2 release files

0.2.0

2 release files

0.1.0

2 release files

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