apc-model-parser 0.1.0__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/AGENTS.md +15 -8
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/PKG-INFO +24 -4
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/README.md +23 -3
- apc_model_parser-0.2.2/docs/chatlogs/2026-06-01_docs-pipx-pypi-install.md +62 -0
- apc_model_parser-0.2.2/docs/chatlogs/2026-06-02_model-library-docs-diff-bump.md +63 -0
- apc_model_parser-0.2.2/docs/chatlogs/2026-06-03_docs-todo-backlog-mkdocs.md +47 -0
- apc_model_parser-0.2.2/docs/chatlogs/2026-06-03_julia-rhs-emit-and-library-sync.md +80 -0
- apc_model_parser-0.2.2/docs/decisions/0006-julia-numerical-rhs-view.md +52 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/index.md +1 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/deployment/ci-cd.md +2 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/design/ir-specification.md +3 -1
- apc_model_parser-0.2.2/docs/design/model-library-and-versioning.md +148 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/design/model-parser.md +23 -10
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/design/storing-mtk-models.md +8 -6
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/index.md +11 -3
- apc_model_parser-0.2.2/docs/todo/conformance-fixtures-parity.md +29 -0
- apc_model_parser-0.2.2/docs/todo/diff-bump-hardening.md +30 -0
- apc_model_parser-0.2.2/docs/todo/emit-cpp-realtime-backend.md +31 -0
- apc_model_parser-0.2.2/docs/todo/emit-ini-round-trip.md +31 -0
- apc_model_parser-0.2.2/docs/todo/index.md +16 -0
- apc_model_parser-0.2.2/docs/todo/ini-dimensions-inference.md +30 -0
- apc_model_parser-0.2.2/docs/todo/ir-schema-migrations.md +32 -0
- apc_model_parser-0.2.2/docs/todo/parameter-set-contract-cli.md +33 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/examples/README.md +7 -2
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/examples/run.sh +6 -1
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/mkdocs.yml +11 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/pyproject.toml +1 -1
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/__init__.py +2 -2
- apc_model_parser-0.2.2/src/model_parser/backends/__init__.py +7 -0
- apc_model_parser-0.2.2/src/model_parser/backends/julia_expr.py +84 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/backends/julia_mtk.py +4 -76
- apc_model_parser-0.2.2/src/model_parser/backends/julia_rhs.py +129 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/cli.py +72 -2
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/frontends/exprtk_ini.py +20 -1
- apc_model_parser-0.2.2/src/model_parser/semantic_diff.py +344 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/tests/test_cli.py +25 -0
- apc_model_parser-0.2.2/tests/test_julia_rhs.py +58 -0
- apc_model_parser-0.2.2/tests/test_semantic_diff.py +220 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/uv.lock +421 -421
- apc_model_parser-0.1.0/src/model_parser/backends/__init__.py +0 -5
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/.github/workflows/ci.yml +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/.github/workflows/docs.yml +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/.github/workflows/release.yml +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/.gitignore +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/api.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/chatlogs/2026-06-01_bootstrap-model-parser.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/chatlogs/2026-06-01_ci-mkdocs-github-pages-pypi.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/0001-python-cli-with-julia-backend.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/0002-codegen-over-serialized-system.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/0003-explicit-expression-ir.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/0004-target-mtk-v11-idioms.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/decisions/0005-cli-verbs-parse-emit.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/docs/design/language-strategy.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/examples/models/model_monod_simple.ini +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/examples/models/model_thermal_tank.ini +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/julia/ModelParserJL/Project.toml +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/julia/ModelParserJL/README.md +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/julia/ModelParserJL/src/ModelParserJL.jl +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/schemas/canonical-ir.schema.json +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/frontends/__init__.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/frontends/expr_parser.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/io.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/ir/__init__.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/ir/expr.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/ir/model.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/schema.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/validation/__init__.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/src/model_parser/validation/validators.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/tests/conftest.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/tests/test_expr_parser.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/tests/test_exprtk_ini.py +0 -0
- {apc_model_parser-0.1.0 → apc_model_parser-0.2.2}/tests/test_julia_mtk.py +0 -0
|
@@ -22,8 +22,9 @@ ecosystem and must remain usable **standalone**.
|
|
|
22
22
|
```text
|
|
23
23
|
authoring (ExprTk INI) --parse--> AST --normalize--> canonical IR (JSON)
|
|
24
24
|
|
|
|
25
|
-
emit julia
|
|
26
|
-
emit
|
|
25
|
+
emit julia --> ModelingToolkit .jl
|
|
26
|
+
emit julia-rhs --> numerical f!/outputs! .jl
|
|
27
|
+
emit cpp --> (planned) realtime C++
|
|
27
28
|
```
|
|
28
29
|
|
|
29
30
|
## Language
|
|
@@ -94,8 +95,8 @@ uv run mkdocs build --strict
|
|
|
94
95
|
### Pure logic vs. I/O separation
|
|
95
96
|
|
|
96
97
|
**Pure modules** parse, normalize, validate, and lower — no filesystem,
|
|
97
|
-
subprocess, or network access. Keep `ir/`, `frontends/`, `backends/`,
|
|
98
|
-
`validation/` pure and deterministic.
|
|
98
|
+
subprocess, or network access. Keep `ir/`, `frontends/`, `backends/`,
|
|
99
|
+
`semantic_diff.py`, and `validation/` pure and deterministic.
|
|
99
100
|
|
|
100
101
|
**I/O modules** read/write files and implement the CLI. `io.py` and `cli.py` own
|
|
101
102
|
filesystem access; the CLI must stay a thin shell over the pure functions.
|
|
@@ -133,7 +134,9 @@ never a serialized `System`. Generated Julia targets **MTK v11** idioms
|
|
|
133
134
|
|
|
134
135
|
Re-running `parse`/`emit` on unchanged input must produce byte-identical output
|
|
135
136
|
(stable ordering, stable number formatting). The content hash depends only on
|
|
136
|
-
the semantic body.
|
|
137
|
+
the semantic body. For `provenance.created_at`, when `SOURCE_DATE_EPOCH` is set
|
|
138
|
+
(see reproducible-builds.org), the INI frontend uses that instant instead of the
|
|
139
|
+
wall clock so regenerated IR JSON stays stable when semantics are unchanged.
|
|
137
140
|
|
|
138
141
|
### Status vocabulary and exit codes
|
|
139
142
|
|
|
@@ -149,7 +152,8 @@ CLI diagnostics use `OK` · `WARN` · `ERROR`. Exit codes:
|
|
|
149
152
|
|
|
150
153
|
- Long options in kebab-case (`--from`, `--profile`, `--output`/`-o`).
|
|
151
154
|
- The two core verbs are `parse` (authoring → IR) and `emit <target>` (IR →
|
|
152
|
-
view). Supporting commands: `validate`, `inspect`, `
|
|
155
|
+
view). Supporting commands: `validate`, `inspect`, `diff`, `bump`, `ast`,
|
|
156
|
+
`schema`.
|
|
153
157
|
- Breaking CLI changes require a SemVer bump and release notes.
|
|
154
158
|
|
|
155
159
|
## Scope guardrails
|
|
@@ -164,13 +168,16 @@ that *consume* the IR.
|
|
|
164
168
|
If a change request conflicts with the design doc, stop and resolve via an
|
|
165
169
|
explicit doc + ADR update — do not silently expand scope.
|
|
166
170
|
|
|
167
|
-
## Work tracking (ADRs and
|
|
171
|
+
## Work tracking (ADRs, issues, and todos)
|
|
168
172
|
|
|
169
173
|
- **ADRs:** numbered files under [`docs/decisions/`](docs/decisions/) (`NNNN-title.md`),
|
|
170
174
|
indexed in [`docs/decisions/index.md`](docs/decisions/index.md). One decision per
|
|
171
175
|
file; never delete — supersede with a newer ADR and update the index.
|
|
172
176
|
- **Issues:** use GitHub issues for backlog items that are not yet an ADR; link
|
|
173
177
|
ADRs from issue/PR text when a decision motivates the change.
|
|
178
|
+
- **Todo briefs:** theme-sized notes under [`docs/todo/`](docs/todo/) (`index.md` +
|
|
179
|
+
one file per theme); promote into ADRs or design docs when behaviour is
|
|
180
|
+
decided. Not a substitute for issues or ADRs.
|
|
174
181
|
- Prefer **small, reviewable slices** (one coherent feature, bugfix, or refactor
|
|
175
182
|
per PR when practical). For larger work, split PRs and reference the same ADR
|
|
176
183
|
or design section in each.
|
|
@@ -203,7 +210,7 @@ docs may stay in `julia/ModelParserJL/` README until unified.
|
|
|
203
210
|
|
|
204
211
|
**Intended layout** (keep consistent with [`docs/design/model-parser.md`](docs/design/model-parser.md)):
|
|
205
212
|
|
|
206
|
-
- `docs/index.md` or root `README.md` — overview, install (`uv`), quick `parse` /
|
|
213
|
+
- `docs/index.md` or root `README.md` — overview, install (PyPI via `pipx` / `uv tool`, dev via `uv`), quick `parse` /
|
|
207
214
|
`emit` examples (when expanded).
|
|
208
215
|
- `docs/design/` — product spec (`model-parser.md`) and deep architecture notes.
|
|
209
216
|
- `docs/decisions/` — ADRs (`NNNN-title.md`) + `index.md`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: apc-model-parser
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Convert process-model definitions to and from a canonical intermediate representation.
|
|
5
5
|
Project-URL: Repository, https://github.com/Advanced-Process-Control/model-parser
|
|
6
6
|
Author: Advanced Process Control
|
|
@@ -26,8 +26,9 @@ model script.
|
|
|
26
26
|
```text
|
|
27
27
|
authoring (ExprTk INI) --parse--> AST --normalize--> canonical IR (JSON)
|
|
28
28
|
|
|
|
29
|
-
emit julia
|
|
30
|
-
emit
|
|
29
|
+
emit julia --> ModelingToolkit .jl
|
|
30
|
+
emit julia-rhs --> numerical f!/outputs! .jl
|
|
31
|
+
emit cpp --> (planned) realtime C++
|
|
31
32
|
```
|
|
32
33
|
|
|
33
34
|
The IR is the single semantic contract. Adding a backend means writing one
|
|
@@ -50,7 +51,21 @@ in-memory, dynamic workflows. Both consume the *same* IR. See
|
|
|
50
51
|
|
|
51
52
|
## Install
|
|
52
53
|
|
|
53
|
-
|
|
54
|
+
### CLI from PyPI (end users)
|
|
55
|
+
|
|
56
|
+
The package on PyPI is **`apc-model-parser`**; the installed command is **`model-parser`**.
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pipx install apc-model-parser
|
|
60
|
+
# or: uv tool install apc-model-parser
|
|
61
|
+
model-parser --help
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
Use **`pipx`** or **`uv tool`** when you only need the CLI in an isolated environment.
|
|
65
|
+
|
|
66
|
+
### From source (development)
|
|
67
|
+
|
|
68
|
+
This repository uses **[uv](https://docs.astral.sh/uv/)** for environments and tasks.
|
|
54
69
|
|
|
55
70
|
```bash
|
|
56
71
|
uv sync --all-groups # include dev tools (ruff, pytest, mkdocs)
|
|
@@ -66,9 +81,14 @@ uv run model-parser parse examples/models/model_monod_simple.ini -o monod.ir.jso
|
|
|
66
81
|
# 2. canonical IR -> ModelingToolkit (v11) Julia model
|
|
67
82
|
uv run model-parser emit julia monod.ir.json -o monod.jl
|
|
68
83
|
|
|
84
|
+
# 2a. canonical IR -> plain numerical ODE RHS (SciML-style f!)
|
|
85
|
+
uv run model-parser emit julia-rhs monod.ir.json -o monod_rhs.jl
|
|
86
|
+
|
|
69
87
|
# Supporting commands
|
|
70
88
|
uv run model-parser validate monod.ir.json --profile julia-analysis
|
|
71
89
|
uv run model-parser inspect monod.ir.json
|
|
90
|
+
uv run model-parser diff monod.ir.json other.ir.json # semantic IR diff
|
|
91
|
+
uv run model-parser bump monod.ir.json other.ir.json # suggested SemVer bump
|
|
72
92
|
uv run model-parser ast examples/models/model_monod_simple.ini # debug tree
|
|
73
93
|
uv run model-parser schema -o schemas/canonical-ir.schema.json # export schema
|
|
74
94
|
```
|
|
@@ -13,8 +13,9 @@ model script.
|
|
|
13
13
|
```text
|
|
14
14
|
authoring (ExprTk INI) --parse--> AST --normalize--> canonical IR (JSON)
|
|
15
15
|
|
|
|
16
|
-
emit julia
|
|
17
|
-
emit
|
|
16
|
+
emit julia --> ModelingToolkit .jl
|
|
17
|
+
emit julia-rhs --> numerical f!/outputs! .jl
|
|
18
|
+
emit cpp --> (planned) realtime C++
|
|
18
19
|
```
|
|
19
20
|
|
|
20
21
|
The IR is the single semantic contract. Adding a backend means writing one
|
|
@@ -37,7 +38,21 @@ in-memory, dynamic workflows. Both consume the *same* IR. See
|
|
|
37
38
|
|
|
38
39
|
## Install
|
|
39
40
|
|
|
40
|
-
|
|
41
|
+
### CLI from PyPI (end users)
|
|
42
|
+
|
|
43
|
+
The package on PyPI is **`apc-model-parser`**; the installed command is **`model-parser`**.
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
pipx install apc-model-parser
|
|
47
|
+
# or: uv tool install apc-model-parser
|
|
48
|
+
model-parser --help
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Use **`pipx`** or **`uv tool`** when you only need the CLI in an isolated environment.
|
|
52
|
+
|
|
53
|
+
### From source (development)
|
|
54
|
+
|
|
55
|
+
This repository uses **[uv](https://docs.astral.sh/uv/)** for environments and tasks.
|
|
41
56
|
|
|
42
57
|
```bash
|
|
43
58
|
uv sync --all-groups # include dev tools (ruff, pytest, mkdocs)
|
|
@@ -53,9 +68,14 @@ uv run model-parser parse examples/models/model_monod_simple.ini -o monod.ir.jso
|
|
|
53
68
|
# 2. canonical IR -> ModelingToolkit (v11) Julia model
|
|
54
69
|
uv run model-parser emit julia monod.ir.json -o monod.jl
|
|
55
70
|
|
|
71
|
+
# 2a. canonical IR -> plain numerical ODE RHS (SciML-style f!)
|
|
72
|
+
uv run model-parser emit julia-rhs monod.ir.json -o monod_rhs.jl
|
|
73
|
+
|
|
56
74
|
# Supporting commands
|
|
57
75
|
uv run model-parser validate monod.ir.json --profile julia-analysis
|
|
58
76
|
uv run model-parser inspect monod.ir.json
|
|
77
|
+
uv run model-parser diff monod.ir.json other.ir.json # semantic IR diff
|
|
78
|
+
uv run model-parser bump monod.ir.json other.ir.json # suggested SemVer bump
|
|
59
79
|
uv run model-parser ast examples/models/model_monod_simple.ini # debug tree
|
|
60
80
|
uv run model-parser schema -o schemas/canonical-ir.schema.json # export schema
|
|
61
81
|
```
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Document PyPI CLI install (pipx and uv tool)
|
|
3
|
+
topic: docs-packaging
|
|
4
|
+
date_added: 2026-06-01
|
|
5
|
+
tags: [chatlogs]
|
|
6
|
+
links:
|
|
7
|
+
- README.md
|
|
8
|
+
- docs/index.md
|
|
9
|
+
- docs/deployment/ci-cd.md
|
|
10
|
+
- AGENTS.md
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Commit helper
|
|
14
|
+
|
|
15
|
+
- **SemVer / version bump:** **No bump** — documentation only; no change to the
|
|
16
|
+
published package API or CLI contract beyond how to install it.
|
|
17
|
+
- **Tags / GitHub Release:** **None** — stack on `main`; releases remain tag-driven
|
|
18
|
+
when version/metadata changes warrant a new **`v*.*.*`**.
|
|
19
|
+
- **Suggested commit message:** `docs: document pipx and uv tool install for apc-model-parser`
|
|
20
|
+
- **Copy-paste git commands:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git add README.md docs/index.md docs/deployment/ci-cd.md AGENTS.md \
|
|
24
|
+
docs/chatlogs/2026-06-01_docs-pipx-pypi-install.md
|
|
25
|
+
git commit -m 'docs: document pipx and uv tool install for apc-model-parser'
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
- **Git order when tagging a release:** N/A this session.
|
|
29
|
+
|
|
30
|
+
## How to try
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
pipx install apc-model-parser
|
|
34
|
+
model-parser --help
|
|
35
|
+
|
|
36
|
+
# Alternative (same CLI, different installer):
|
|
37
|
+
# uv tool install apc-model-parser
|
|
38
|
+
|
|
39
|
+
# Docs site (after deploy):
|
|
40
|
+
# uv run mkdocs build --strict
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Session narrative
|
|
44
|
+
|
|
45
|
+
**Goal.** After the first PyPI publish and manual **`v0.1.0`** tag, document that
|
|
46
|
+
end users can install the CLI with **`pipx install apc-model-parser`**, not only
|
|
47
|
+
**`uv tool install`**, while keeping **`apc-model-parser`** vs **`model-parser`**
|
|
48
|
+
(dist name vs command) explicit.
|
|
49
|
+
|
|
50
|
+
**Shipped surface.**
|
|
51
|
+
|
|
52
|
+
- **`README.md`:** Install split into **CLI from PyPI** (`pipx` primary, `uv tool`
|
|
53
|
+
comment) and **from source** (`uv sync --all-groups`).
|
|
54
|
+
- **`docs/index.md`:** Published site home — same dual path for PyPI installs;
|
|
55
|
+
short note that both are isolated env installs with `model-parser` on `PATH`.
|
|
56
|
+
- **`docs/deployment/ci-cd.md`:** One line after the release job listing consumer
|
|
57
|
+
**`pipx`** / **`uv tool install`** post-publish.
|
|
58
|
+
- **`AGENTS.md`:** Documentation layout bullet updated to mention PyPI install via
|
|
59
|
+
**`pipx` / `uv tool`** and dev via **`uv`**.
|
|
60
|
+
|
|
61
|
+
**Follow-ups.** None required; optional future “Getting started” page could repeat
|
|
62
|
+
install if the nav grows.
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Model library design, diff/bump CLI, and model-library bootstrap
|
|
3
|
+
topic: documentation
|
|
4
|
+
date_added: 2026-06-02
|
|
5
|
+
tags: [chatlogs]
|
|
6
|
+
links:
|
|
7
|
+
- AGENTS.md
|
|
8
|
+
- docs/design/model-parser.md
|
|
9
|
+
- docs/design/model-library-and-versioning.md
|
|
10
|
+
- src/model_parser/cli.py
|
|
11
|
+
- src/model_parser/semantic_diff.py
|
|
12
|
+
- src/model_parser/frontends/exprtk_ini.py
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Commit helper
|
|
16
|
+
|
|
17
|
+
- **SemVer / version bump:** **MINOR** — user-visible CLI (`diff`, `bump`), new pure module `semantic_diff.py`, and `SOURCE_DATE_EPOCH` behaviour for `provenance.created_at` are new public behaviour (not docs-only).
|
|
18
|
+
- **Tags / GitHub Release:** **None** — stack on default branch; tag when maintainers cut a release (existing `release.yml` on tag).
|
|
19
|
+
- **Suggested commit message:** `feat(cli): add IR diff/bump and model-library design doc`
|
|
20
|
+
- **Copy-paste git commands:**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
git add AGENTS.md README.md docs/design/model-library-and-versioning.md \
|
|
24
|
+
docs/design/model-parser.md docs/design/ir-specification.md \
|
|
25
|
+
docs/index.md docs/chatlogs/2026-06-02_model-library-docs-diff-bump.md \
|
|
26
|
+
mkdocs.yml src/model_parser/cli.py src/model_parser/semantic_diff.py \
|
|
27
|
+
src/model_parser/frontends/exprtk_ini.py tests/test_cli.py tests/test_semantic_diff.py
|
|
28
|
+
git commit -m "$(cat <<'EOF'
|
|
29
|
+
feat(cli): add IR diff/bump and model-library design doc
|
|
30
|
+
|
|
31
|
+
Add semantic comparison and advisory SemVer bump; document library workflows;
|
|
32
|
+
honour SOURCE_DATE_EPOCH for reproducible IR provenance timestamps.
|
|
33
|
+
EOF
|
|
34
|
+
)"
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
- **Git order when tagging:** commit / push branch (with version bump if releasing) → annotated tag on that commit → push tag.
|
|
38
|
+
|
|
39
|
+
## How to try
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
cd /path/to/model-parser
|
|
43
|
+
uv sync --all-groups
|
|
44
|
+
uv run model-parser parse examples/models/model_monod_simple.ini -o /tmp/a.ir.json
|
|
45
|
+
uv run model-parser parse examples/models/model_monod_simple.ini -o /tmp/b.ir.json
|
|
46
|
+
uv run model-parser diff /tmp/a.ir.json /tmp/b.ir.json
|
|
47
|
+
uv run model-parser bump /tmp/a.ir.json /tmp/b.ir.json --json
|
|
48
|
+
SOURCE_DATE_EPOCH=946684800 uv run model-parser parse examples/models/model_monod_simple.ini -o /tmp/c.ir.json
|
|
49
|
+
uv run pytest tests/test_semantic_diff.py
|
|
50
|
+
uv run mkdocs build --strict
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Sibling repo `model-library`: set `MODEL_PARSER_VENV` to this repo’s `.venv` and run `./scripts/sync.sh` (see that repo’s README).
|
|
54
|
+
|
|
55
|
+
## Session narrative
|
|
56
|
+
|
|
57
|
+
**Goal:** Capture the prior design answer in-repo, add `diff` / `bump` to support a versioned model library, and bootstrap `Advanced-Process-Control/model-library` with the two existing example models.
|
|
58
|
+
|
|
59
|
+
**Shipped:** New design page `docs/design/model-library-and-versioning.md` (hashes vs SemVer vs git, workflows, authoring vs parameter sets, optimal multi-file layout, reproducible timestamps); nav and cross-links (`mkdocs.yml`, `docs/index.md`, `model-parser.md`, `ir-specification.md`); `src/model_parser/semantic_diff.py` with conservative bump policy; CLI commands `diff` and `bump` (`--json`); INI frontend respects `SOURCE_DATE_EPOCH` for `provenance.created_at`; tests (`tests/test_semantic_diff.py`, CLI smoke); README and `AGENTS.md` updates.
|
|
60
|
+
|
|
61
|
+
**model-library repo:** Added `models/monod_simple` and `models/thermal_tank` with copied authoring INIs, `scripts/sync.sh` + `scripts/update_lock.py`, committed generated `model.ir.json` / `views/model.jl`, `library.lock.json`, README, and GitHub Actions CI that installs `model-parser` from git `main` and fails on drift after sync.
|
|
62
|
+
|
|
63
|
+
**Follow-ups:** Optional ADR for bump policy; `emit ini` and parameter-set JSON remain roadmap; publish a PyPI release so CI can pin a version instead of `main` if desired.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Tracked todo briefs under docs/todo and MkDocs nav
|
|
3
|
+
topic: documentation
|
|
4
|
+
date_added: 2026-06-03
|
|
5
|
+
tags: [chatlogs]
|
|
6
|
+
links:
|
|
7
|
+
- AGENTS.md
|
|
8
|
+
- docs/todo/index.md
|
|
9
|
+
- mkdocs.yml
|
|
10
|
+
- docs/index.md
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Commit helper
|
|
14
|
+
|
|
15
|
+
- **SemVer / version bump:** **no bump** — documentation and contributor-guide updates only (`docs/todo/**`, `mkdocs.yml`, `docs/index.md`, `AGENTS.md`). No user-visible CLI or IR contract change.
|
|
16
|
+
- **Tags / GitHub Release:** **None** — stack on default branch.
|
|
17
|
+
- **Suggested commit message:** `docs: add tracked todo backlog under docs/todo`
|
|
18
|
+
- **Copy-paste git commands:**
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
git add AGENTS.md docs/index.md docs/todo/ mkdocs.yml \
|
|
22
|
+
docs/chatlogs/2026-06-03_docs-todo-backlog-mkdocs.md
|
|
23
|
+
git commit -m "$(cat <<'EOF'
|
|
24
|
+
docs: add tracked todo backlog under docs/todo
|
|
25
|
+
|
|
26
|
+
Add theme-sized future-work briefs, MkDocs Future work nav, and AGENTS work-tracking note.
|
|
27
|
+
EOF
|
|
28
|
+
)"
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- **Git order when tagging:** N/A (no release in this slice).
|
|
32
|
+
|
|
33
|
+
## How to try
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
cd /path/to/model-parser
|
|
37
|
+
uv run mkdocs build --strict
|
|
38
|
+
# optional: open docs/todo/index.md in the editor or browse site → Future work
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Session narrative
|
|
42
|
+
|
|
43
|
+
**Goal:** Add a `docs/todo/` area with one Markdown file per major future implementation theme, wired into the published docs site, and record guidance on whether `model-library`’s `sync.sh` should auto-commit/push (recommendation: keep sync as regenerate-only; optional separate commit helper; avoid default auto-push).
|
|
44
|
+
|
|
45
|
+
**Shipped:** `docs/todo/index.md` plus seven task files (`emit-ini-round-trip`, `emit-cpp-realtime-backend`, `ir-schema-migrations`, `parameter-set-contract-cli`, `conformance-fixtures-parity`, `ini-dimensions-inference`, `diff-bump-hardening`); `mkdocs.yml` **Future work** nav listing all pages (satisfies `--strict`); link from `docs/index.md`; `AGENTS.md` **Work tracking** section renamed to include todo briefs and clarify they complement ADRs/issues. MkDocs strict fixes: removed invalid links from `docs/` into `src/` / repo root; use code spans or in-repo doc links only.
|
|
46
|
+
|
|
47
|
+
**Follow-ups:** Optional `model-library` script `sync-and-commit.sh` (opt-in commit, no default push) if maintainers want scripted commits; promote individual todo themes into GitHub issues or ADRs when scoped.
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Julia numerical RHS emit target and model-library sync
|
|
3
|
+
topic: codegen
|
|
4
|
+
date_added: 2026-06-03
|
|
5
|
+
tags: [chatlogs]
|
|
6
|
+
links:
|
|
7
|
+
- AGENTS.md
|
|
8
|
+
- docs/design/model-parser.md
|
|
9
|
+
- docs/decisions/0006-julia-numerical-rhs-view.md
|
|
10
|
+
- src/model_parser/backends/julia_expr.py
|
|
11
|
+
- src/model_parser/backends/julia_rhs.py
|
|
12
|
+
- src/model_parser/cli.py
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Commit helper
|
|
16
|
+
|
|
17
|
+
- **SemVer / version bump:** **PATCH** (`0.2.1` → `0.2.2`) — new CLI subcommand `emit julia-rhs` and new public Python API `emit_julia_rhs`; backward-compatible for existing `emit julia` users.
|
|
18
|
+
- **Tags / GitHub Release:** **None** — stack on default branch; tag when cutting a PyPI release (existing `release.yml` on tag).
|
|
19
|
+
- **Suggested commit message (model-parser repo):** `feat(emit): add julia-rhs numerical ODE view`
|
|
20
|
+
- **Copy-paste git commands (model-parser):**
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
cd /path/to/model-parser
|
|
24
|
+
git add AGENTS.md README.md docs/design/model-library-and-versioning.md \
|
|
25
|
+
docs/design/model-parser.md docs/design/storing-mtk-models.md \
|
|
26
|
+
docs/decisions/0006-julia-numerical-rhs-view.md docs/decisions/index.md \
|
|
27
|
+
docs/chatlogs/2026-06-03_julia-rhs-emit-and-library-sync.md \
|
|
28
|
+
examples/README.md examples/run.sh mkdocs.yml pyproject.toml \
|
|
29
|
+
src/model_parser/__init__.py src/model_parser/backends/__init__.py \
|
|
30
|
+
src/model_parser/backends/julia_expr.py src/model_parser/backends/julia_mtk.py \
|
|
31
|
+
src/model_parser/backends/julia_rhs.py src/model_parser/cli.py \
|
|
32
|
+
tests/test_cli.py tests/test_julia_rhs.py
|
|
33
|
+
git commit -m "$(cat <<'EOF'
|
|
34
|
+
feat(emit): add julia-rhs numerical ODE view
|
|
35
|
+
|
|
36
|
+
Share IR→Julia expression lowering in julia_expr; emit f!/outputs! codegen;
|
|
37
|
+
document packing and ADR 0006; extend examples and model-library design notes.
|
|
38
|
+
EOF
|
|
39
|
+
)"
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
- **Suggested commit message (model-library repo, separate clone):** `chore(views): add model_rhs.jl and lock digests from emit julia-rhs`
|
|
43
|
+
- **Copy-paste git commands (model-library):**
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
cd /path/to/model-library
|
|
47
|
+
git add README.md library.lock.json scripts/sync.sh scripts/update_lock.py \
|
|
48
|
+
models/*/model.ir.json models/*/views/model.jl models/*/views/model_rhs.jl
|
|
49
|
+
git commit -m "$(cat <<'EOF'
|
|
50
|
+
chore(views): sync numerical RHS views and lockfile
|
|
51
|
+
|
|
52
|
+
Regenerate IR/MTK views; add model_rhs.jl and julia_rhs_* lock fields per sync.
|
|
53
|
+
EOF
|
|
54
|
+
)"
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
- **Git order when tagging:** commit / push branch (with version bump if releasing) → annotated tag on that commit → push tag.
|
|
58
|
+
|
|
59
|
+
## How to try
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
cd /path/to/model-parser
|
|
63
|
+
uv sync --all-groups
|
|
64
|
+
uv run model-parser parse examples/models/model_monod_simple.ini -o /tmp/m.ir.json
|
|
65
|
+
uv run model-parser emit julia-rhs /tmp/m.ir.json
|
|
66
|
+
uv run pytest tests/test_julia_rhs.py tests/test_cli.py
|
|
67
|
+
uv run mkdocs build --strict
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
**model-library:** `MODEL_PARSER_VENV=/path/to/model-parser/.venv ./scripts/sync.sh` then inspect `models/*/views/model_rhs.jl` and `library.lock.json`.
|
|
71
|
+
|
|
72
|
+
## Session narrative
|
|
73
|
+
|
|
74
|
+
**Goal:** Implement a second Julia backend that emits an explicit numerical RHS (`f!` and optional `outputs!`) from the canonical IR, and wire the sibling `model-library` sync + lockfile to generate and fingerprint `views/model_rhs.jl`.
|
|
75
|
+
|
|
76
|
+
**Shipped (model-parser):** New module `julia_expr.py` (shared `expr_to_julia`, `julia_model_slug`, `julia_number_literal`, `JuliaCodegenError`); `julia_mtk.py` refactored to use it; `julia_rhs.py` with `emit_julia_rhs`; CLI `emit julia-rhs`; tests; PATCH version bump; ADR 0006; design/README/AGENTS/examples updates; MkDocs nav entry.
|
|
77
|
+
|
|
78
|
+
**Shipped (model-library):** `sync.sh` runs `emit julia-rhs` to `views/model_rhs.jl`; `update_lock.py` records `julia_rhs_relpath` and `julia_rhs_content_hash`; README updated; all models re-synced (committed artifacts include new `.jl` files and refreshed lock).
|
|
79
|
+
|
|
80
|
+
**Follow-ups:** Optional `ApcModelAnalysis.jl` helper to load `model_rhs.jl`; conformance tests comparing MTK trajectory vs plain `ODEProblem` built from `f!` for small fixtures.
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# ADR 0006: Julia numerical RHS view (`emit julia-rhs`)
|
|
2
|
+
|
|
3
|
+
## Status
|
|
4
|
+
|
|
5
|
+
accepted
|
|
6
|
+
|
|
7
|
+
## Context
|
|
8
|
+
|
|
9
|
+
Some analysis workflows (explicit vector ODEs, custom sensitivity tooling, or
|
|
10
|
+
bridges that do not use ModelingToolkit) need a **plain in-place RHS**
|
|
11
|
+
`f!(du, u, p, t)` with stable symbol-to-index packing, while the ecosystem
|
|
12
|
+
standard remains an MTK-generated `System` from the same IR.
|
|
13
|
+
|
|
14
|
+
## Decision
|
|
15
|
+
|
|
16
|
+
Add a second Julia **codegen** target, `emit julia-rhs`, that lowers the same
|
|
17
|
+
canonical IR to:
|
|
18
|
+
|
|
19
|
+
- `f_<model_slug>!(du, u, p, t)` when the scaffold has no inputs, or
|
|
20
|
+
`f_<model_slug>!(du, u, p, t, inp)` when it has inputs (`inp` order = IR inputs
|
|
21
|
+
list order);
|
|
22
|
+
- `outputs_<model_slug>!(y, u, p, t)` (same optional `inp`) when the IR
|
|
23
|
+
carries output equations.
|
|
24
|
+
|
|
25
|
+
Packing rules: `u` and `du` follow `ir.states` order; `p` follows `ir.parameters`
|
|
26
|
+
order (defaults in the IR are **not** applied inside `f!` — callers supply
|
|
27
|
+
numeric `p`). Locals are emitted as sequential assignments in IR order, aligned
|
|
28
|
+
with the MTK lowering order.
|
|
29
|
+
|
|
30
|
+
Expression rendering is shared with the MTK backend via `julia_expr.py` so
|
|
31
|
+
semantics are not duplicated.
|
|
32
|
+
|
|
33
|
+
## Consequences
|
|
34
|
+
|
|
35
|
+
- **Positive:** One IR, two diffable Julia views; numerical and symbolic stacks
|
|
36
|
+
stay aligned.
|
|
37
|
+
- **Negative:** Callers must respect documented packing; no automatic wiring to
|
|
38
|
+
MTK `ODEProblem` from the RHS view alone.
|
|
39
|
+
|
|
40
|
+
## Alternatives considered
|
|
41
|
+
|
|
42
|
+
1. **Generate RHS only in downstream repos** — rejected: duplicates expression
|
|
43
|
+
semantics and drifts from the IR contract.
|
|
44
|
+
2. **Single `emit julia` with a flag** — rejected: CLI stays clearer with
|
|
45
|
+
separate targets (`emit cpp`, etc.) per ADR 0005.
|
|
46
|
+
|
|
47
|
+
## References
|
|
48
|
+
|
|
49
|
+
- ADR 0002 (codegen over serialized `System`)
|
|
50
|
+
- ADR 0003 (explicit expression IR)
|
|
51
|
+
- ADR 0005 (CLI `emit <target>` shape)
|
|
52
|
+
- `docs/design/model-parser.md` §5 (CLI)
|
|
@@ -17,6 +17,7 @@ code and review naturally in pull requests.
|
|
|
17
17
|
| [0003](0003-explicit-expression-ir.md) | Explicit expression IR, not string rewrites | accepted | 2026-06-01 |
|
|
18
18
|
| [0004](0004-target-mtk-v11-idioms.md) | Generated Julia targets ModelingToolkit v11 idioms | accepted | 2026-06-01 |
|
|
19
19
|
| [0005](0005-cli-verbs-parse-emit.md) | CLI shape: `parse` and `emit <target>` as core verbs | accepted | 2026-06-01 |
|
|
20
|
+
| [0006](0006-julia-numerical-rhs-view.md) | Second Julia view: plain `f!` / `outputs!` from IR (`emit julia-rhs`) | accepted | 2026-06-03 |
|
|
20
21
|
|
|
21
22
|
## Format
|
|
22
23
|
|
|
@@ -41,6 +41,8 @@ The job:
|
|
|
41
41
|
3. Creates a **GitHub Release** (with generated notes) and attaches the built files
|
|
42
42
|
4. Publishes to **PyPI** using **trusted publishing (OIDC)** — no long-lived API token in secrets
|
|
43
43
|
|
|
44
|
+
After publish, end users typically install the CLI with **`pipx install apc-model-parser`** or **`uv tool install apc-model-parser`** (command on `PATH`: **`model-parser`**).
|
|
45
|
+
|
|
44
46
|
### PyPI trusted publisher
|
|
45
47
|
|
|
46
48
|
Configure the pending publisher on PyPI for:
|
|
@@ -53,7 +53,9 @@ one namespace; duplicates are a validation error.
|
|
|
53
53
|
|
|
54
54
|
`provenance.content_hash` is `sha256` over the canonical JSON of the IR body
|
|
55
55
|
**excluding** `provenance`. Downstream artifacts reference a scaffold by this
|
|
56
|
-
hash, not by file path.
|
|
56
|
+
hash, not by file path. For how this interacts with a versioned model library,
|
|
57
|
+
SemVer, and git, see
|
|
58
|
+
[`model-library-and-versioning.md`](model-library-and-versioning.md).
|
|
57
59
|
|
|
58
60
|
## 3. Expression sub-language
|
|
59
61
|
|