Skip to main content

refresh-engine

refresh-engine is an asyncio-first, domain-neutral Python library for discovering resources, detecting changes, planning dependency-aware work, and executing application-defined refresh operations safely.

Features

  • full, incremental, targeted, and dependency-aware refresh modes
  • deterministic fingerprints and reliable cheap pre-checks
  • bounded concurrency, retries, timeouts, and overlap policies
  • transactional state with an in-memory default and application-injected durable stores
  • asyncio and externally managed scheduling
  • typed public protocols and ABC inheritance points
  • native structlog lifecycle logging with configurable processors and redaction

Requires Python 3.12.

RefreshEngine uses InMemoryStateStore when store is omitted. Applications can inject a SQLite, PostgreSQL, or other adapter through the public StateStore protocol or StateStoreABC:

engine = RefreshEngine(source, operation, store=my_store)

SQLite and PostgreSQL reference adapters are provided under examples/; database clients are not part of the production package.

Quick start

import asyncio
from refresh_engine import (
    DiscoveryResult, PlanAction, RefreshEngine, Resource, ResourceSnapshot,
)

class Source:
    async def discover(self):
        async def resources():
            yield Resource("alpha")
        return DiscoveryResult(resources())

    async def snapshot(self, resource):
        return ResourceSnapshot(resource.resource_id, content={"value": 1})

async def apply(resource, snapshot, action, request):
    assert resource is not None
    print(action, resource.resource_id)

async def main():
    engine = RefreshEngine(Source(), apply)
    result = await engine.refresh()
    print(result.status, result.refreshed_count)
    await engine.close()

asyncio.run(main())

For a PlanAction.DELETE, the operation receives a lightweight Resource carrying the deleted ID and snapshot=None; deletion handling must not expect source payloads.

Documentation

Development and support

See CONTRIBUTING.md, SECURITY.md, the changelog, and the Apache 2.0 license.

Release files for refresh-engine 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 refresh-engine 0.1.0
File Size Uploaded
refresh_engine-0.1.0.tar.gz 95.4 kB Details

Built distribution (wheel)

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

Total release size: 130.8 kB

Release files / refresh_engine-0.1.0.tar.gz

Download URL refresh_engine-0.1.0.tar.gz
Size 95.4 kB
Tags Source
SHA-256 checksum
How to use checksums
ff3ff553e6bd6759d9388bade1650fc4827d8ce0923430c353828b6ecf61151d
BLAKE2b-256 checksum
How to use checksums
c0bffe914cfc09dcb3a3ef7e5adf3535c5f67999473850d5962c59625ab028f3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

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

Download URL refresh_engine-0.1.0-py3-none-any.whl
Size 35.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
270b91adb45c8099f6bf49938787ac6372707a249722e6efdc33dc2b87e983c7
BLAKE2b-256 checksum
How to use checksums
73483f38b354ed9966c5eaf0ed293ff527a4062f0c728b544d198e68e832b825
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.15 {"installer":{"name":"uv","version":"0.12.15","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

Release history Release notifications | RSS feed

This release

0.1.0 This release

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