grain-core
Grain's storage-agnostic workflow engine: a pure advance() reducer and a RunStore port, with a
conformance kit that any store can prove itself against.
Zero dependencies beyond grain-contracts (the
vocabulary), so a service can drive Grain workflows without installing Grain's CLI. The reducer is
pure — no clock, no filesystem, no store — and every side effect comes back as data for the driver
to apply. That is how one engine serves grain-kit's filesystem runs and Diwa's Postgres missions.
from grain_contracts.workflow import Run
from grain_core import advance, RunStore
from grain_core.kernel import StepStarted
transition = advance(run, StepStarted(step_id=run.cursor), now="2026-07-14T00:00:00Z")
store.save(transition.run, expected_version=version) # driver applies the result
for effect in transition.effects: # ...and any effects, as data
...
Implementing a store
RunStore is a Protocol with four methods — load, save(run, *, expected_version),
discard_artifact, list_runs. Prove your implementation against the shared kit:
from grain_core.conformance import run_conformance
def test_my_store_conforms():
run_conformance(lambda: MyRunStore(...)) # a fresh, empty store per call
The kit pins the version contract the port leaves to implementers: version tokens are opaque;
save(expected_version=None) creates (and conflicts if the run already exists);
save(expected_version=token) updates iff the token is current, else raises
ConcurrentModification; list_runs is newest-first by created.
Source and issues · MIT
Release files for grain-core 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| grain_core-0.1.0.tar.gz | 13.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| grain_core-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 22.8 kB
Release files / grain_core-0.1.0.tar.gz
| Download URL | grain_core-0.1.0.tar.gz |
|---|---|
| Size | 13.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
2aa610aea43ca89014a6933d760a4b098ad32f881b1726aab72044ff95a0d8f3
|
|
BLAKE2b-256 checksum How to use checksums |
20776905834afd6b7994d6a0b451a0460ebd5cd7c000b112d5803caebf7fbaeb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / grain_core-0.1.0-py3-none-any.whl
| Download URL | grain_core-0.1.0-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7bf0a79717c370c4a71b203fdc2410f4490f24de80435ad8a40e6dcba1e5e190
|
|
BLAKE2b-256 checksum How to use checksums |
d7810bc91ce0bd1c9f1b110a254ad563963160660cf10c88bff9e4c49246b5a9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.29 {"installer":{"name":"uv","version":"0.11.29","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|