Skip to main content

glyff

Guaranteed Lightweight Yieldable Function Foundation.

A primitive for pausing async functions across process and request boundaries, and resuming them later from the same point.

Install

pip install glyff

glyff has no dependencies beyond the Python standard library.

Behavior

  • Marked function calls are recorded in a session-scoped execution repository, keyed by function identity, arguments, and an ordinal among identical calls.
  • Re-invoking the same completed call within the same session returns the recorded result instead of re-executing.
  • An exception persists nothing: the interrupted call stays STARTED (retried on resume), completed descendant work remains committed, and the original exception propagates.
  • To pause a session intentionally, raise an application-owned exception and catch it outside the Session block.

Public API

Name Description
Domain Versioned ownership boundary; its engrave marks a function.
Session Async context manager that scopes a sequence of engraved calls.
ExecutionId Identifier for a recorded function execution.
DomainId A domain's persistent machine identifier.
ExecutionName The recorded name of an engraved function.
ArgumentsDigest Digest of a call's canonical arguments.
Execution Aggregate Root for a recorded function execution.
ExecutionStatus Enum: STARTED, COMPLETED.
SerializedValue Serializer-neutral persisted value (results, metadata).
CanonicalArguments A call's encoded canonical arguments, the preimage of its key.
CanonicalArgumentValue A logical canonical value, including a fallback.
CanonicalFallback A fallback representation in a canonical argument.
Metadata Metadata entry owned by an Execution.
ExecutionRepository Repository for execution aggregates.
Transaction Active transaction boundary.
TransactionProvider Provider used by TransactionScope.
Serializer Protocol for value serialization.
ArgumentCanonicalizer Contract for normalizing bound call arguments into a canonical form.
CanonicalValue A value in the JSON data model.
SessionId The name a session's records are stored under.

glyff.migration carries the offline half: MigratableBackend and SessionMigration for a store that can replace a session atomically, SessionMigrator for what a session should become, and DomainMigration — declared as the ExecutionShape pairs that changed shape — as the one glyff ships. See migration.

Every engraved function belongs to a domain, which owns and versions its records:

engrave = glyff.Domain("com.example.payments", version="3").engrave

The first call into a domain records that version for the session, and a later call under a different one raises DomainVersionMismatchError rather than migrating. See migration.

Persistent boundaries should declare an identity such as @engrave(name="chat.reply"), so Python function renames do not change recorded keys. Without name, glyff derives it from the function's module and __qualname__.

Extending

  • For persistent storage, see glyff-sqlite (production) and glyff-file-store (debug).
  • For Pydantic-typed serialization, see glyff-pydantic.
  • Custom backends provide an ExecutionRepository, a TransactionProvider and claim_domain, usually through a small backend bundle. See the backends doc.
  • glyff.testing carries a conformance suite for each extension point, listed in the backends doc (planned: #36).

Status

Pre-1.0 — the API is unstable and will change. See the documentation for the guarantees and what is planned.

License

MIT

Download files

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

Source Distribution

glyff-0.16.0.tar.gz (74.1 kB view details)

Uploaded Source

Built Distribution

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

glyff-0.16.0-py3-none-any.whl (64.9 kB view details)

Uploaded Python 3

File details

Details for the file glyff-0.16.0.tar.gz.

File metadata

  • Download URL: glyff-0.16.0.tar.gz
  • Upload date:
  • Size: 74.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for glyff-0.16.0.tar.gz
Algorithm Hash digest
SHA256 54fde7a80a7489b5e2d36e96e4340c9fb48bd1b044ddb593b96e74c3ae22167e
MD5 37c7129a874f15d7d2e3b382b1cd619d
BLAKE2b-256 4efd4461f2e7682242dc03fb65be17003a37b44d5487509ca6f9c2acb5ceb9cb

See more details on using hashes here.

Provenance

The following attestation bundles were made for glyff-0.16.0.tar.gz:

Publisher: publish-glyff.yml on nueruyu/glyff

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

File details

Details for the file glyff-0.16.0-py3-none-any.whl.

File metadata

  • Download URL: glyff-0.16.0-py3-none-any.whl
  • Upload date:
  • Size: 64.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for glyff-0.16.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b46e5901ec1dbc4275be822c67beb247970d9f1de1624b7771f8b1f674a53ff8
MD5 0b07fad921cd1473a2f0b3362f2f0205
BLAKE2b-256 b67a7ee88abed17418b439ccceb38038a0d3f83821d921ccd41b38e76cf68926

See more details on using hashes here.

Provenance

The following attestation bundles were made for glyff-0.16.0-py3-none-any.whl:

Publisher: publish-glyff.yml on nueruyu/glyff

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

Release history Release notifications | RSS feed

This release

0.16.0 This release

2 files

0.15.0

2 files

0.14.0

2 files

0.13.0

2 files

0.12.0

2 files

0.11.0

2 files

0.10.0

2 files

0.9.0

2 files

0.8.0

2 files

0.7.0

2 files

0.6.0

2 files

0.5.0

2 files

0.4.0

2 files

0.3.0

2 files

0.2.0

2 files

0.1.0

2 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