labcode 0.0.1__py3-none-any.whl

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.
labcode/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """labcode -- the ``lc`` CLI, a dialect wrapper over the ofplang toolchain."""
labcode/__main__.py ADDED
@@ -0,0 +1,9 @@
1
+ """Enable ``python -m labcode <command> ...``.
2
+
3
+ Intent: mirror the console-script entry point so the CLI is reachable without an
4
+ installed script, which is convenient in dev checkouts and CI.
5
+ """
6
+
7
+ from labcode.cli import main
8
+
9
+ raise SystemExit(main())
labcode/cli.py ADDED
@@ -0,0 +1,99 @@
1
+ """labcode ``lc`` command-line interface.
2
+
3
+ ``lc`` is the entry point for the labcode dialect of the Object-flow Programming
4
+ Language. It is a thin dispatcher over the ofplang toolchain: each subcommand is
5
+ forwarded to a sibling package's own CLI, in-process::
6
+
7
+ lc validate ... -> ofplang.validate.cli.main
8
+ lc schedule ... -> ofplang.schedule.cli.main
9
+ lc run ... -> ofplang.run.cli.main
10
+
11
+ At this version ``lc`` forwards to the ofplang siblings unchanged (no dialect
12
+ behavior yet). The seam -- routing each subcommand independently -- is where the
13
+ labcode dialect and its custom runner will later diverge. Each subcommand keeps
14
+ its own options, exit codes, and ``--help``; ``lc`` adds no behavior of its own
15
+ beyond routing plus a top-level ``--help``/``--version``.
16
+ """
17
+
18
+ from __future__ import annotations
19
+
20
+ import importlib
21
+ import sys
22
+ from collections.abc import Sequence
23
+
24
+ # Subcommand -> dotted path of the sibling CLI module exposing ``main(argv)``.
25
+ # Kept as strings so each sibling is imported lazily, only when its subcommand is
26
+ # invoked: ``lc --help`` need not import a scheduler's ortools/numpy stack, and a
27
+ # subcommand fails with a clear message if its package is somehow missing. This
28
+ # dict is also the divergence seam: a later labcode version replaces an entry
29
+ # (e.g. ``run``) with its own module to add dialect / custom-runner behavior.
30
+ _SUBCOMMANDS: dict[str, str] = {
31
+ "validate": "ofplang.validate.cli",
32
+ "schedule": "ofplang.schedule.cli",
33
+ "run": "ofplang.run.cli",
34
+ }
35
+
36
+ _USAGE = """\
37
+ usage: lc <command> [options]
38
+
39
+ The labcode CLI: a dialect wrapper over the Object-flow Programming Language
40
+ toolchain. Subcommands forward to the ofplang toolchain.
41
+
42
+ commands:
43
+ validate check a workflow document is well-formed portable v0
44
+ schedule compute a schedule for a workflow
45
+ run execute a workflow (rolling-horizon runner / simulator)
46
+
47
+ Run `lc <command> --help` for command-specific options.
48
+
49
+ options:
50
+ -h, --help show this help and exit
51
+ -V, --version show version and exit
52
+ """
53
+
54
+
55
+ def _version() -> str:
56
+ from importlib.metadata import PackageNotFoundError, version
57
+
58
+ try:
59
+ return version("labcode")
60
+ except PackageNotFoundError: # editable/source tree without installed metadata
61
+ return "0+unknown"
62
+
63
+
64
+ def main(argv: Sequence[str] | None = None) -> int:
65
+ args = list(sys.argv[1:] if argv is None else argv)
66
+
67
+ if not args:
68
+ sys.stderr.write(_USAGE)
69
+ return 2
70
+
71
+ head = args[0]
72
+ if head in ("-h", "--help"):
73
+ sys.stdout.write(_USAGE)
74
+ return 0
75
+ if head in ("-V", "--version"):
76
+ sys.stdout.write(f"lc {_version()}\n")
77
+ return 0
78
+ if head.startswith("-"):
79
+ sys.stderr.write(f"lc: unrecognized option {head!r}\n\n")
80
+ sys.stderr.write(_USAGE)
81
+ return 2
82
+
83
+ module_path = _SUBCOMMANDS.get(head)
84
+ if module_path is None:
85
+ sys.stderr.write(f"lc: unknown command {head!r}\n\n")
86
+ sys.stderr.write(_USAGE)
87
+ return 2
88
+
89
+ try:
90
+ module = importlib.import_module(module_path)
91
+ except ImportError as exc:
92
+ sys.stderr.write(
93
+ f"lc: the '{head}' command requires a package that is not installed "
94
+ f"({exc}).\n"
95
+ )
96
+ return 2
97
+
98
+ exit_code: int = module.main(args[1:])
99
+ return exit_code
labcode/py.typed ADDED
File without changes
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.4
2
+ Name: labcode
3
+ Version: 0.0.1
4
+ Summary: labcode -- a dialect wrapper over the Object-Flow Programming Language toolchain
5
+ Author-email: Kazunari Kaizu <kwaizu@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/ofplang/labcode
8
+ Project-URL: Repository, https://github.com/ofplang/labcode
9
+ Keywords: ofplang,labcode,dataflow,workflow,cli
10
+ Classifier: Development Status :: 3 - Alpha
11
+ Classifier: Intended Audience :: Developers
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Classifier: Topic :: Software Development :: Compilers
19
+ Classifier: Typing :: Typed
20
+ Requires-Python: >=3.10
21
+ Description-Content-Type: text/markdown
22
+ License-File: LICENSE
23
+ Requires-Dist: ofplang-validate>=0.1.0
24
+ Requires-Dist: ofplang-schedule>=0.1.0
25
+ Requires-Dist: ofplang-run>=0.1.0
26
+ Provides-Extra: test
27
+ Requires-Dist: pytest>=7.0; extra == "test"
28
+ Provides-Extra: dev
29
+ Requires-Dist: pytest>=7.0; extra == "dev"
30
+ Requires-Dist: ruff>=0.16; extra == "dev"
31
+ Requires-Dist: mypy>=1.11; extra == "dev"
32
+ Dynamic: license-file
33
+
34
+ # labcode
35
+
36
+ [![CI](https://github.com/ofplang/labcode/actions/workflows/ci.yml/badge.svg)](https://github.com/ofplang/labcode/actions/workflows/ci.yml)
37
+ [![PyPI](https://img.shields.io/pypi/v/labcode.svg)](https://pypi.org/project/labcode/)
38
+
39
+ The **`lc`** command-line interface for the **labcode** dialect of the
40
+ **Object-flow Programming Language**. Installing this one package pulls in the
41
+ ofplang toolchain and exposes it under a single command:
42
+
43
+ ```sh
44
+ lc validate ... # check a workflow is well-formed portable v0
45
+ lc schedule ... # compute a schedule for a workflow
46
+ lc run ... # execute a workflow (rolling-horizon runner / simulator)
47
+ ```
48
+
49
+ labcode is where a site-specific dialect and a custom runner (real lab hardware)
50
+ are developed on top of the ofplang toolchain. At this version `lc` is a thin
51
+ dispatcher that forwards each subcommand to the ofplang siblings **unchanged**;
52
+ the dialect and custom-runner behavior will land in later versions, replacing
53
+ individual subcommands behind the same interface.
54
+
55
+ ## Install
56
+
57
+ ```sh
58
+ pip install labcode
59
+ ```
60
+
61
+ Requires Python 3.10+. This package is a thin dispatcher; it depends on the
62
+ ofplang sibling packages that do the work:
63
+
64
+ - [`ofplang-validate`](https://github.com/ofplang/validate) — the validator
65
+ - [`ofplang-schedule`](https://github.com/ofplang/schedule) — the scheduler
66
+ - [`ofplang-run`](https://github.com/ofplang/run) — the runner / simulator
67
+
68
+ The language is defined in the [ofplang/spec](https://github.com/ofplang/spec)
69
+ repository.
70
+
71
+ ## Usage
72
+
73
+ Each subcommand keeps its own options, exit codes, and `--help`:
74
+
75
+ ```sh
76
+ lc --help # top-level help
77
+ lc <command> --help # command-specific options
78
+ lc --version
79
+ ```
80
+
81
+ `lc` can also be run as a module: `python -m labcode <command> ...`.
82
+
83
+ ## License
84
+
85
+ MIT
@@ -0,0 +1,10 @@
1
+ labcode/__init__.py,sha256=jS_lhcLqdu2BfOAq6j5jPTvGNY5M3_1RMJtNRr3ABp4,79
2
+ labcode/__main__.py,sha256=T5DM7E3tdcuKP4oQ7JacBP4Mi-VmujWueJvB9yCIQTc,252
3
+ labcode/cli.py,sha256=4hRRbSftf4CUl5Uh9HlwI7Qou46DsrnPy91UDre2k_Q,3319
4
+ labcode/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ labcode-0.0.1.dist-info/licenses/LICENSE,sha256=weUnWoHlmaiawSjaLy_ECNpyTe7F5vDBfLGJKocpUhI,1071
6
+ labcode-0.0.1.dist-info/METADATA,sha256=UYN509QiMtodkausdZECUKMZn1ZggfmwU0hO1_ZCAos,3064
7
+ labcode-0.0.1.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
8
+ labcode-0.0.1.dist-info/entry_points.txt,sha256=eP2fNwGx6ZYNJ_AWzGZhiDJaPqeqaA0iZAc-Tae1PGQ,40
9
+ labcode-0.0.1.dist-info/top_level.txt,sha256=7WhrsXy6psZ8TDzksIEEuj2q93GeXWkHL9h1RbdBrJg,8
10
+ labcode-0.0.1.dist-info/RECORD,,
@@ -0,0 +1,5 @@
1
+ Wheel-Version: 1.0
2
+ Generator: setuptools (83.0.0)
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
5
+
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lc = labcode.cli:main
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Kazunari Kaizu
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1 @@
1
+ labcode