labcode 0.0.1__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.
@@ -0,0 +1,45 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ fail-fast: false
14
+ matrix:
15
+ python-version: ["3.10", "3.11", "3.12", "3.13"]
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ - uses: actions/setup-python@v5
19
+ with:
20
+ python-version: ${{ matrix.python-version }}
21
+ cache: pip
22
+ - run: pip install -e ".[test]"
23
+ - run: pytest
24
+
25
+ lint:
26
+ runs-on: ubuntu-latest
27
+ steps:
28
+ - uses: actions/checkout@v4
29
+ - uses: actions/setup-python@v5
30
+ with:
31
+ python-version: "3.12"
32
+ cache: pip
33
+ - run: pip install -e ".[dev]"
34
+ - run: ruff check labcode tests
35
+
36
+ typecheck:
37
+ runs-on: ubuntu-latest
38
+ steps:
39
+ - uses: actions/checkout@v4
40
+ - uses: actions/setup-python@v5
41
+ with:
42
+ python-version: "3.12"
43
+ cache: pip
44
+ - run: pip install -e ".[dev]"
45
+ - run: mypy
@@ -0,0 +1,94 @@
1
+ name: Publish
2
+
3
+ # Tag-driven release via PyPI Trusted Publishing (OIDC) — no API tokens.
4
+ #
5
+ # Version comes from the pushed git tag via setuptools-scm (`v0.0.1` -> 0.0.1).
6
+ # Routing:
7
+ # - a pre-release tag containing `rc` (e.g. v0.0.1rc1) -> TestPyPI (rehearsal)
8
+ # - any other `v*` tag (e.g. v0.0.1) -> PyPI (production)
9
+ # - manual workflow_dispatch -> choose the target explicitly (run it from a
10
+ # tagged commit, else setuptools-scm yields a dev+local version PyPI rejects)
11
+ #
12
+ # PyPI-side setup (done once, by the project owner): register a Trusted Publisher
13
+ # for owner=ofplang, repo=labcode, workflow=publish.yml, environment=pypi
14
+ # (and environment=testpypi on TestPyPI). First release: register as "pending".
15
+ # The published distribution name is `labcode`.
16
+
17
+ on:
18
+ push:
19
+ tags: ["v*"]
20
+ workflow_dispatch:
21
+ inputs:
22
+ target:
23
+ description: "Publish target"
24
+ type: choice
25
+ options: [testpypi, pypi]
26
+ default: testpypi
27
+
28
+ jobs:
29
+ build:
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - uses: actions/checkout@v4
33
+ with:
34
+ # setuptools-scm derives the version from tags + history.
35
+ fetch-depth: 0
36
+ - uses: actions/setup-python@v5
37
+ with:
38
+ python-version: "3.12"
39
+ - run: python -m pip install --upgrade build twine
40
+ - run: python -m build
41
+ - run: twine check dist/*
42
+ # Guard against ambiguous tags: the built version (from setuptools-scm) must
43
+ # equal the pushed tag — e.g. tag v0.0.1 must build 0.0.1. Catches a commit
44
+ # carrying two tags (an rc and a release) where git describe can resolve to
45
+ # the wrong one and publish the wrong artifact.
46
+ - name: Verify built version matches tag
47
+ if: startsWith(github.ref, 'refs/tags/')
48
+ shell: bash
49
+ run: |
50
+ tag="${GITHUB_REF_NAME#v}"
51
+ built="$(ls dist/*.tar.gz | sed -E 's#.*/[^/]*-([0-9][^-]*)\.tar\.gz#\1#')"
52
+ echo "tag=$tag built=$built"
53
+ if [ "$tag" != "$built" ]; then
54
+ echo "::error::built version $built != tag $tag (ambiguous or misplaced tag?)"
55
+ exit 1
56
+ fi
57
+ - uses: actions/upload-artifact@v4
58
+ with:
59
+ name: dist
60
+ path: dist/
61
+
62
+ publish-testpypi:
63
+ needs: build
64
+ if: >-
65
+ github.event_name == 'workflow_dispatch' && inputs.target == 'testpypi'
66
+ || (github.event_name == 'push' && contains(github.ref_name, 'rc'))
67
+ runs-on: ubuntu-latest
68
+ environment: testpypi
69
+ permissions:
70
+ id-token: write
71
+ steps:
72
+ - uses: actions/download-artifact@v4
73
+ with:
74
+ name: dist
75
+ path: dist/
76
+ - uses: pypa/gh-action-pypi-publish@release/v1
77
+ with:
78
+ repository-url: https://test.pypi.org/legacy/
79
+
80
+ publish-pypi:
81
+ needs: build
82
+ if: >-
83
+ github.event_name == 'workflow_dispatch' && inputs.target == 'pypi'
84
+ || (github.event_name == 'push' && !contains(github.ref_name, 'rc'))
85
+ runs-on: ubuntu-latest
86
+ environment: pypi
87
+ permissions:
88
+ id-token: write
89
+ steps:
90
+ - uses: actions/download-artifact@v4
91
+ with:
92
+ name: dist
93
+ path: dist/
94
+ - uses: pypa/gh-action-pypi-publish@release/v1
@@ -0,0 +1,14 @@
1
+ __pycache__/
2
+ *.py[cod]
3
+ .pytest_cache/
4
+ .mypy_cache/
5
+ .ruff_cache/
6
+ *.egg-info/
7
+ build/
8
+ dist/
9
+ .venv/
10
+ venv/
11
+
12
+ # Local working notes, not part of the published project (until explicitly committed).
13
+ CLAUDE.md
14
+ dev-notes/
labcode-0.0.1/LICENSE ADDED
@@ -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.
labcode-0.0.1/PKG-INFO ADDED
@@ -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,52 @@
1
+ # labcode
2
+
3
+ [![CI](https://github.com/ofplang/labcode/actions/workflows/ci.yml/badge.svg)](https://github.com/ofplang/labcode/actions/workflows/ci.yml)
4
+ [![PyPI](https://img.shields.io/pypi/v/labcode.svg)](https://pypi.org/project/labcode/)
5
+
6
+ The **`lc`** command-line interface for the **labcode** dialect of the
7
+ **Object-flow Programming Language**. Installing this one package pulls in the
8
+ ofplang toolchain and exposes it under a single command:
9
+
10
+ ```sh
11
+ lc validate ... # check a workflow is well-formed portable v0
12
+ lc schedule ... # compute a schedule for a workflow
13
+ lc run ... # execute a workflow (rolling-horizon runner / simulator)
14
+ ```
15
+
16
+ labcode is where a site-specific dialect and a custom runner (real lab hardware)
17
+ are developed on top of the ofplang toolchain. At this version `lc` is a thin
18
+ dispatcher that forwards each subcommand to the ofplang siblings **unchanged**;
19
+ the dialect and custom-runner behavior will land in later versions, replacing
20
+ individual subcommands behind the same interface.
21
+
22
+ ## Install
23
+
24
+ ```sh
25
+ pip install labcode
26
+ ```
27
+
28
+ Requires Python 3.10+. This package is a thin dispatcher; it depends on the
29
+ ofplang sibling packages that do the work:
30
+
31
+ - [`ofplang-validate`](https://github.com/ofplang/validate) — the validator
32
+ - [`ofplang-schedule`](https://github.com/ofplang/schedule) — the scheduler
33
+ - [`ofplang-run`](https://github.com/ofplang/run) — the runner / simulator
34
+
35
+ The language is defined in the [ofplang/spec](https://github.com/ofplang/spec)
36
+ repository.
37
+
38
+ ## Usage
39
+
40
+ Each subcommand keeps its own options, exit codes, and `--help`:
41
+
42
+ ```sh
43
+ lc --help # top-level help
44
+ lc <command> --help # command-specific options
45
+ lc --version
46
+ ```
47
+
48
+ `lc` can also be run as a module: `python -m labcode <command> ...`.
49
+
50
+ ## License
51
+
52
+ MIT
@@ -0,0 +1 @@
1
+ """labcode -- the ``lc`` CLI, a dialect wrapper over the ofplang toolchain."""
@@ -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())
@@ -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
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,19 @@
1
+ .gitignore
2
+ LICENSE
3
+ README.md
4
+ pyproject.toml
5
+ .github/workflows/ci.yml
6
+ .github/workflows/publish.yml
7
+ labcode/__init__.py
8
+ labcode/__main__.py
9
+ labcode/cli.py
10
+ labcode/py.typed
11
+ labcode.egg-info/PKG-INFO
12
+ labcode.egg-info/SOURCES.txt
13
+ labcode.egg-info/dependency_links.txt
14
+ labcode.egg-info/entry_points.txt
15
+ labcode.egg-info/requires.txt
16
+ labcode.egg-info/scm_file_list.json
17
+ labcode.egg-info/scm_version.json
18
+ labcode.egg-info/top_level.txt
19
+ tests/test_cli.py
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ lc = labcode.cli:main
@@ -0,0 +1,11 @@
1
+ ofplang-validate>=0.1.0
2
+ ofplang-schedule>=0.1.0
3
+ ofplang-run>=0.1.0
4
+
5
+ [dev]
6
+ pytest>=7.0
7
+ ruff>=0.16
8
+ mypy>=1.11
9
+
10
+ [test]
11
+ pytest>=7.0
@@ -0,0 +1,15 @@
1
+ {
2
+ "files": [
3
+ "pyproject.toml",
4
+ "LICENSE",
5
+ "README.md",
6
+ ".gitignore",
7
+ ".github/workflows/ci.yml",
8
+ ".github/workflows/publish.yml",
9
+ "labcode/py.typed",
10
+ "labcode/__init__.py",
11
+ "labcode/cli.py",
12
+ "labcode/__main__.py",
13
+ "tests/test_cli.py"
14
+ ]
15
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "tag": "0.0.1",
3
+ "distance": 0,
4
+ "node": "g2bed3fb3bc0c6869010eb5d23a84b7cc9f6ef9a7",
5
+ "dirty": false,
6
+ "branch": "HEAD",
7
+ "node_date": "2026-07-26"
8
+ }
@@ -0,0 +1 @@
1
+ labcode
@@ -0,0 +1,82 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77", "setuptools-scm>=8"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "labcode"
7
+ description = "labcode -- a dialect wrapper over the Object-Flow Programming Language toolchain"
8
+ requires-python = ">=3.10"
9
+ dynamic = ["version"]
10
+ readme = "README.md"
11
+ license = "MIT"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Kazunari Kaizu", email = "kwaizu@gmail.com" }]
14
+ keywords = ["ofplang", "labcode", "dataflow", "workflow", "cli"]
15
+ classifiers = [
16
+ "Development Status :: 3 - Alpha",
17
+ "Intended Audience :: Developers",
18
+ "Operating System :: OS Independent",
19
+ "Programming Language :: Python :: 3",
20
+ "Programming Language :: Python :: 3.10",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Topic :: Software Development :: Compilers",
25
+ "Typing :: Typed",
26
+ ]
27
+ # labcode is a thin dispatcher: it bundles the toolchain by depending on the
28
+ # ofplang sibling packages and forwards each subcommand to their CLIs in-process.
29
+ # Siblings are resolved from PyPI; the lower bound matches the sibling-to-sibling
30
+ # convention (`>=0.1.0`). At this version labcode adds no behavior beyond routing.
31
+ dependencies = [
32
+ "ofplang-validate>=0.1.0",
33
+ "ofplang-schedule>=0.1.0",
34
+ "ofplang-run>=0.1.0",
35
+ ]
36
+
37
+ [project.urls]
38
+ Homepage = "https://github.com/ofplang/labcode"
39
+ Repository = "https://github.com/ofplang/labcode"
40
+
41
+ [project.optional-dependencies]
42
+ test = ["pytest>=7.0"]
43
+ dev = ["pytest>=7.0", "ruff>=0.16", "mypy>=1.11"]
44
+
45
+ [project.scripts]
46
+ # The labcode command. Subcommands (`lc validate|schedule|run`) forward to the
47
+ # ofplang sibling packages' own CLIs.
48
+ lc = "labcode.cli:main"
49
+
50
+ # Version is derived from git tags (e.g. `v0.0.1`) by setuptools-scm. Until the
51
+ # first tag exists, fall back to a static placeholder so a source/editable tree
52
+ # still builds and reports a version.
53
+ [tool.setuptools_scm]
54
+ fallback_version = "0.0.0"
55
+
56
+ # labcode is an ordinary top-level package (it has an __init__.py); this
57
+ # distribution provides only the `labcode` package.
58
+ [tool.setuptools.packages.find]
59
+ include = ["labcode*"]
60
+
61
+ # Ship the PEP 561 marker so downstreams see this package as typed.
62
+ [tool.setuptools.package-data]
63
+ "labcode" = ["py.typed"]
64
+
65
+ [tool.pytest.ini_options]
66
+ testpaths = ["tests"]
67
+ pythonpath = ["."]
68
+ addopts = "-ra"
69
+
70
+ [tool.ruff]
71
+ line-length = 100
72
+ target-version = "py310"
73
+
74
+ [tool.ruff.lint]
75
+ select = ["E", "F", "I", "UP", "B", "SIM", "C4", "W"]
76
+
77
+ [tool.mypy]
78
+ python_version = "3.10"
79
+ files = ["labcode"]
80
+ ignore_missing_imports = true
81
+ warn_unused_ignores = true
82
+ warn_redundant_casts = true
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,47 @@
1
+ """Behavioral tests for the labcode dispatcher.
2
+
3
+ These exercise only `lc`-level routing; each subcommand's behavior is covered in
4
+ its own ofplang sibling repository. `validate` is used as the dispatch probe
5
+ because it is the lightest sibling (PyYAML only, no ortools/numpy).
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import pytest
11
+
12
+ from labcode.cli import main
13
+
14
+
15
+ def test_no_args_is_usage_error(capsys: pytest.CaptureFixture[str]) -> None:
16
+ assert main([]) == 2
17
+ assert "usage: lc" in capsys.readouterr().err
18
+
19
+
20
+ def test_help_goes_to_stdout_and_succeeds(capsys: pytest.CaptureFixture[str]) -> None:
21
+ assert main(["--help"]) == 0
22
+ out = capsys.readouterr().out
23
+ assert "usage: lc" in out
24
+ assert "validate" in out and "schedule" in out and "run" in out
25
+
26
+
27
+ def test_version(capsys: pytest.CaptureFixture[str]) -> None:
28
+ assert main(["--version"]) == 0
29
+ assert capsys.readouterr().out.startswith("lc ")
30
+
31
+
32
+ def test_unknown_command_is_usage_error(capsys: pytest.CaptureFixture[str]) -> None:
33
+ assert main(["frobnicate"]) == 2
34
+ assert "unknown command" in capsys.readouterr().err
35
+
36
+
37
+ def test_unrecognized_option_is_usage_error(capsys: pytest.CaptureFixture[str]) -> None:
38
+ assert main(["--nope"]) == 2
39
+ assert "unrecognized option" in capsys.readouterr().err
40
+
41
+
42
+ def test_dispatches_to_subcommand() -> None:
43
+ # A missing path is the validator's own usage error (exit 2), returned as a
44
+ # plain int; proves routing reaches the sibling and its exit code passes
45
+ # through unchanged. (`validate --help` would instead raise SystemExit from
46
+ # argparse, which is correct at runtime but awkward to assert on here.)
47
+ assert main(["validate", "no-such-file.yaml"]) == 2