Skip to content

openregs compile

Code-generate typed constants from a release’s executable blocks.

Generate typed constants from every atom executable block in force on a release’s as-of date, so a regulatory value becomes a build-time dependency of the code that has to obey it. Each constant is emitted with its value, unit, atom id, source citation and release tag in a docstring (Python) or a JSDoc block (TypeScript), and a test is generated beside the module asserting every value against a release at test time: run it against the release it was compiled from and it passes, run it against a later release that moved a value and it fails, naming both. The release is read from its own corpus.sqlite and every digest it declares is recomputed first; output is stamped with the tag, the as-of date and the commit, never with the clock, so recompiling one release twice writes identical bytes.

openregs compile [-h] --release <regime>@<tag> --lang <language> --out <dir>
[--root <path>]
Option
--release <regime>@<tag>the built release to compile, for example fixreg@2025.02 (required)
--lang <language>the target language: python or typescript (required, one of python, typescript)
--out <dir>the directory to write the generated module and its test into; created if absent (required)
--root <path>repository root, where the release is read from

Rendered from openregs/openregs@cbe9615:tooling/openregs/cli/main.py