labcode 0.1.1__tar.gz → 0.1.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.
Files changed (46) hide show
  1. {labcode-0.1.1 → labcode-0.1.2}/PKG-INFO +3 -3
  2. {labcode-0.1.1 → labcode-0.1.2}/labcode/run_cli.py +6 -6
  3. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/PKG-INFO +3 -3
  4. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/requires.txt +2 -2
  5. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/scm_version.json +2 -2
  6. {labcode-0.1.1 → labcode-0.1.2}/pyproject.toml +2 -2
  7. {labcode-0.1.1 → labcode-0.1.2}/tests/test_run_cli.py +36 -0
  8. {labcode-0.1.1 → labcode-0.1.2}/.github/workflows/ci.yml +0 -0
  9. {labcode-0.1.1 → labcode-0.1.2}/.github/workflows/publish.yml +0 -0
  10. {labcode-0.1.1 → labcode-0.1.2}/.gitignore +0 -0
  11. {labcode-0.1.1 → labcode-0.1.2}/LICENSE +0 -0
  12. {labcode-0.1.1 → labcode-0.1.2}/README.md +0 -0
  13. {labcode-0.1.1 → labcode-0.1.2}/SPECIFICATIONS.md +0 -0
  14. {labcode-0.1.1 → labcode-0.1.2}/examples/README.md +0 -0
  15. {labcode-0.1.1 → labcode-0.1.2}/examples/outputs/plate_line.boundary.yaml +0 -0
  16. {labcode-0.1.1 → labcode-0.1.2}/examples/outputs/plate_line.observation.yaml +0 -0
  17. {labcode-0.1.1 → labcode-0.1.2}/examples/outputs/plate_line.plan.yaml +0 -0
  18. {labcode-0.1.1 → labcode-0.1.2}/examples/outputs/plate_line.svg +0 -0
  19. {labcode-0.1.1 → labcode-0.1.2}/examples/plate_line.boundary.yaml +0 -0
  20. {labcode-0.1.1 → labcode-0.1.2}/examples/plate_line.env.yaml +0 -0
  21. {labcode-0.1.1 → labcode-0.1.2}/examples/plate_line.workflow.yaml +0 -0
  22. {labcode-0.1.1 → labcode-0.1.2}/examples/render_plate_line.py +0 -0
  23. {labcode-0.1.1 → labcode-0.1.2}/labcode/__init__.py +0 -0
  24. {labcode-0.1.1 → labcode-0.1.2}/labcode/__main__.py +0 -0
  25. {labcode-0.1.1 → labcode-0.1.2}/labcode/_child.py +0 -0
  26. {labcode-0.1.1 → labcode-0.1.2}/labcode/backend.py +0 -0
  27. {labcode-0.1.1 → labcode-0.1.2}/labcode/cli.py +0 -0
  28. {labcode-0.1.1 → labcode-0.1.2}/labcode/dialect.py +0 -0
  29. {labcode-0.1.1 → labcode-0.1.2}/labcode/idgen.py +0 -0
  30. {labcode-0.1.1 → labcode-0.1.2}/labcode/objectid.py +0 -0
  31. {labcode-0.1.1 → labcode-0.1.2}/labcode/py.typed +0 -0
  32. {labcode-0.1.1 → labcode-0.1.2}/labcode/runner.py +0 -0
  33. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/SOURCES.txt +0 -0
  34. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/dependency_links.txt +0 -0
  35. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/entry_points.txt +0 -0
  36. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/scm_file_list.json +0 -0
  37. {labcode-0.1.1 → labcode-0.1.2}/labcode.egg-info/top_level.txt +0 -0
  38. {labcode-0.1.1 → labcode-0.1.2}/setup.cfg +0 -0
  39. {labcode-0.1.1 → labcode-0.1.2}/tests/fixtures/device_script.env.yaml +0 -0
  40. {labcode-0.1.1 → labcode-0.1.2}/tests/fixtures/device_script.workflow.yaml +0 -0
  41. {labcode-0.1.1 → labcode-0.1.2}/tests/fixtures/transport.env.yaml +0 -0
  42. {labcode-0.1.1 → labcode-0.1.2}/tests/fixtures/transport.workflow.yaml +0 -0
  43. {labcode-0.1.1 → labcode-0.1.2}/tests/test_backend.py +0 -0
  44. {labcode-0.1.1 → labcode-0.1.2}/tests/test_cli.py +0 -0
  45. {labcode-0.1.1 → labcode-0.1.2}/tests/test_dialect.py +0 -0
  46. {labcode-0.1.1 → labcode-0.1.2}/tests/test_objectid.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labcode
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: labcode -- a dialect wrapper over the Object-Flow Programming Language toolchain
5
5
  Author-email: Kazunari Kaizu <kwaizu@gmail.com>
6
6
  License-Expression: MIT
@@ -20,9 +20,9 @@ Classifier: Typing :: Typed
20
20
  Requires-Python: >=3.10
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: ofplang-validate>=0.1.2
23
+ Requires-Dist: ofplang-validate>=0.1.3
24
24
  Requires-Dist: ofplang-schedule>=0.1.3
25
- Requires-Dist: ofplang-run>=0.1.9
25
+ Requires-Dist: ofplang-run>=0.1.10
26
26
  Provides-Extra: test
27
27
  Requires-Dist: pytest>=7.0; extra == "test"
28
28
  Provides-Extra: dev
@@ -122,14 +122,14 @@ def main(argv: Sequence[str] | None = None) -> int:
122
122
 
123
123
  # labcode dialect front door: validate the env x-labcode extension (P5) over the
124
124
  # workflow (for (1)/(2) exclusivity) and the environment. Warnings are printed but do
125
- # not block; errors are a usage error.
126
- workflow_doc, err = _read_document(args.workflow, "workflow")
127
- if err is not None:
128
- return err
125
+ # not block; errors are a usage error. Use the *expanded* workflow the shared front
126
+ # door already resolved (`fd.document`), so `$import` is applied once, no second read
127
+ # happens, and imported types/ops are visible to the dialect check and `_id` setup.
128
+ workflow_doc = fd.document or {}
129
129
  env_doc, err = _read_document(args.env, "environment")
130
130
  if err is not None:
131
131
  return err
132
- dialect = validate_dialect(workflow_doc or {}, env_doc or {})
132
+ dialect = validate_dialect(workflow_doc, env_doc or {})
133
133
  for warning in dialect.warnings:
134
134
  print(f"lc run: warning: {warning}", file=sys.stderr)
135
135
  if not dialect.ok:
@@ -153,7 +153,7 @@ def main(argv: Sequence[str] | None = None) -> int:
153
153
  # declare `_id`, mint the boundary's Object ids, share one IdGenerator with the
154
154
  # backend); it runs the rewritten document in memory (no temp file).
155
155
  result = run_labcode(
156
- workflow_doc or {},
156
+ workflow_doc,
157
157
  args.env,
158
158
  boundary,
159
159
  running_task_margin=margin,
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: labcode
3
- Version: 0.1.1
3
+ Version: 0.1.2
4
4
  Summary: labcode -- a dialect wrapper over the Object-Flow Programming Language toolchain
5
5
  Author-email: Kazunari Kaizu <kwaizu@gmail.com>
6
6
  License-Expression: MIT
@@ -20,9 +20,9 @@ Classifier: Typing :: Typed
20
20
  Requires-Python: >=3.10
21
21
  Description-Content-Type: text/markdown
22
22
  License-File: LICENSE
23
- Requires-Dist: ofplang-validate>=0.1.2
23
+ Requires-Dist: ofplang-validate>=0.1.3
24
24
  Requires-Dist: ofplang-schedule>=0.1.3
25
- Requires-Dist: ofplang-run>=0.1.9
25
+ Requires-Dist: ofplang-run>=0.1.10
26
26
  Provides-Extra: test
27
27
  Requires-Dist: pytest>=7.0; extra == "test"
28
28
  Provides-Extra: dev
@@ -1,6 +1,6 @@
1
- ofplang-validate>=0.1.2
1
+ ofplang-validate>=0.1.3
2
2
  ofplang-schedule>=0.1.3
3
- ofplang-run>=0.1.9
3
+ ofplang-run>=0.1.10
4
4
 
5
5
  [dev]
6
6
  pytest>=7.0
@@ -1,7 +1,7 @@
1
1
  {
2
- "tag": "0.1.1",
2
+ "tag": "0.1.2",
3
3
  "distance": 0,
4
- "node": "g486c970a4db122421a1238a63c0390fe48037a98",
4
+ "node": "gff018ed68475b09b06a1fcfbe92d5f5796bfa36a",
5
5
  "dirty": false,
6
6
  "branch": "HEAD",
7
7
  "node_date": "2026-07-28"
@@ -32,9 +32,9 @@ classifiers = [
32
32
  # support so a described workflow passes the front door (spec 2.7, >=0.1.2). `validate`
33
33
  # and `schedule` subcommands still forward unchanged.
34
34
  dependencies = [
35
- "ofplang-validate>=0.1.2",
35
+ "ofplang-validate>=0.1.3",
36
36
  "ofplang-schedule>=0.1.3",
37
- "ofplang-run>=0.1.9",
37
+ "ofplang-run>=0.1.10",
38
38
  ]
39
39
 
40
40
  [project.urls]
@@ -82,6 +82,42 @@ def test_e2e_lc_run_stamps_deterministic_object_ids(tmp_path):
82
82
  assert doc1 == yaml.safe_load(rb2.read_text(encoding="utf-8")) # deterministic
83
83
 
84
84
 
85
+ def test_e2e_lc_run_expands_imported_object_types_and_stamps_ids(tmp_path):
86
+ # `$import` and `_id` compose: the object types (Plate/Tube) are moved into an
87
+ # imported fragment, so the shared front door must expand it first; then
88
+ # LabcodeRunner injects `_id` into those *imported* object types. The Tube id
89
+ # still round-trips, proving expansion happens before `_id` injection.
90
+ pytest.importorskip("ofplang.schedule", reason="ofplang-schedule not installed")
91
+ import yaml
92
+
93
+ src = (EXAMPLES / "plate_line.workflow.yaml").read_text(encoding="utf-8")
94
+ head, body = src[: src.index("types:")], src[src.index("processes:") :]
95
+ (tmp_path / "plate_types.yaml").write_text(
96
+ "Plate:\n domain: object\n view:\n barcode: { type: String }\n"
97
+ "Tube:\n domain: object\n",
98
+ encoding="utf-8",
99
+ )
100
+ wf = tmp_path / "plate_line.workflow.yaml"
101
+ wf.write_text(head + "types:\n $import: ./plate_types.yaml\n" + body, encoding="utf-8")
102
+
103
+ rb = tmp_path / "rb.yaml"
104
+ code = run_cli.main(
105
+ [
106
+ str(wf),
107
+ "--env", str(EXAMPLES / "plate_line.env.yaml"),
108
+ "--boundary", str(EXAMPLES / "plate_line.boundary.yaml"),
109
+ "--seconds-per-tick", "0.001",
110
+ "-o", str(tmp_path / "status.yaml"),
111
+ "--boundary-out", str(rb),
112
+ ]
113
+ )
114
+ assert code == 0
115
+ doc = yaml.safe_load(rb.read_text(encoding="utf-8"))
116
+ out_tube = doc["boundary"]["outputs"]["tube"]["view"]
117
+ in_tube = doc["boundary"]["inputs"]["tube"]["view"]
118
+ assert out_tube["_id"] and out_tube["_id"] == in_tube["_id"]
119
+
120
+
85
121
  def test_cli_dialect_error_is_a_usage_error(tmp_path, capsys):
86
122
  # A non-python x-labcode script is rejected at the dialect front door (exit 2), before
87
123
  # any execution.
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes