ofplang 0.1.0__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.
@@ -0,0 +1 @@
1
+ """ofplang.ofp -- the umbrella ``ofp`` CLI that dispatches to the toolchain."""
@@ -0,0 +1,9 @@
1
+ """Enable ``python -m ofplang.ofp <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 ofplang.ofp.cli import main
8
+
9
+ raise SystemExit(main())
ofplang/ofp/cli.py ADDED
@@ -0,0 +1,92 @@
1
+ """Umbrella ``ofp`` command-line interface.
2
+
3
+ ``ofp`` is a thin dispatcher over the Object-flow Programming Language toolchain.
4
+ It forwards each subcommand to a sibling package's own CLI, in-process::
5
+
6
+ ofp validate ... -> ofplang.validate.cli.main
7
+ ofp schedule ... -> ofplang.schedule.cli.main
8
+ ofp run ... -> ofplang.run.cli.main
9
+
10
+ Each subcommand keeps its own options, exit codes, and ``--help``; ``ofp`` adds
11
+ no behavior of its own beyond routing plus a top-level ``--help``/``--version``.
12
+ """
13
+
14
+ from __future__ import annotations
15
+
16
+ import importlib
17
+ import sys
18
+ from collections.abc import Sequence
19
+
20
+ # Subcommand -> dotted path of the sibling CLI module exposing ``main(argv)``.
21
+ # Kept as strings so each sibling is imported lazily, only when its subcommand is
22
+ # invoked: ``ofp --help`` need not import a scheduler's ortools/numpy stack, and a
23
+ # subcommand fails with a clear message if its package is somehow missing.
24
+ _SUBCOMMANDS: dict[str, str] = {
25
+ "validate": "ofplang.validate.cli",
26
+ "schedule": "ofplang.schedule.cli",
27
+ "run": "ofplang.run.cli",
28
+ }
29
+
30
+ _USAGE = """\
31
+ usage: ofp <command> [options]
32
+
33
+ The umbrella CLI for the Object-flow Programming Language toolchain.
34
+
35
+ commands:
36
+ validate check a workflow document is well-formed portable v0
37
+ schedule compute a schedule for a workflow
38
+ run execute a workflow (rolling-horizon runner / simulator)
39
+
40
+ Run `ofp <command> --help` for command-specific options.
41
+
42
+ options:
43
+ -h, --help show this help and exit
44
+ -V, --version show version and exit
45
+ """
46
+
47
+
48
+ def _version() -> str:
49
+ from importlib.metadata import PackageNotFoundError, version
50
+
51
+ try:
52
+ return version("ofplang")
53
+ except PackageNotFoundError: # editable/source tree without installed metadata
54
+ return "0+unknown"
55
+
56
+
57
+ def main(argv: Sequence[str] | None = None) -> int:
58
+ args = list(sys.argv[1:] if argv is None else argv)
59
+
60
+ if not args:
61
+ sys.stderr.write(_USAGE)
62
+ return 2
63
+
64
+ head = args[0]
65
+ if head in ("-h", "--help"):
66
+ sys.stdout.write(_USAGE)
67
+ return 0
68
+ if head in ("-V", "--version"):
69
+ sys.stdout.write(f"ofp {_version()}\n")
70
+ return 0
71
+ if head.startswith("-"):
72
+ sys.stderr.write(f"ofp: unrecognized option {head!r}\n\n")
73
+ sys.stderr.write(_USAGE)
74
+ return 2
75
+
76
+ module_path = _SUBCOMMANDS.get(head)
77
+ if module_path is None:
78
+ sys.stderr.write(f"ofp: unknown command {head!r}\n\n")
79
+ sys.stderr.write(_USAGE)
80
+ return 2
81
+
82
+ try:
83
+ module = importlib.import_module(module_path)
84
+ except ImportError as exc:
85
+ sys.stderr.write(
86
+ f"ofp: the '{head}' command requires a package that is not installed "
87
+ f"({exc}).\n"
88
+ )
89
+ return 2
90
+
91
+ exit_code: int = module.main(args[1:])
92
+ return exit_code
ofplang/ofp/py.typed ADDED
File without changes
@@ -0,0 +1,88 @@
1
+ Metadata-Version: 2.4
2
+ Name: ofplang
3
+ Version: 0.1.0
4
+ Summary: Umbrella `ofp` command-line interface for 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/ofp
8
+ Project-URL: Repository, https://github.com/ofplang/ofp
9
+ Keywords: ofplang,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
+ # ofplang
35
+
36
+ [![CI](https://github.com/ofplang/ofp/actions/workflows/ci.yml/badge.svg)](https://github.com/ofplang/ofp/actions/workflows/ci.yml)
37
+ [![PyPI](https://img.shields.io/pypi/v/ofplang.svg)](https://pypi.org/project/ofplang/)
38
+
39
+ The umbrella **`ofp`** command-line interface for the **Object-flow Programming
40
+ Language** toolchain. Installing this one package pulls in the whole toolchain
41
+ and exposes it under a single command:
42
+
43
+ ```sh
44
+ ofp validate ... # check a workflow is well-formed portable v0
45
+ ofp schedule ... # compute a schedule for a workflow
46
+ ofp run ... # execute a workflow (rolling-horizon runner / simulator)
47
+ ```
48
+
49
+ The language is defined in the [ofplang/spec](https://github.com/ofplang/spec)
50
+ repository.
51
+
52
+ ## Install
53
+
54
+ ```sh
55
+ pip install ofplang
56
+ ```
57
+
58
+ Requires Python 3.10+. This package is a thin dispatcher; it depends on the
59
+ sibling packages that do the work:
60
+
61
+ - [`ofplang-validate`](https://github.com/ofplang/validate) — the validator
62
+ - [`ofplang-schedule`](https://github.com/ofplang/schedule) — the scheduler
63
+ - [`ofplang-run`](https://github.com/ofplang/run) — the runner / simulator
64
+
65
+ ## Command line
66
+
67
+ ```sh
68
+ ofp <command> [options] # or: python -m ofplang.ofp <command> [options]
69
+ ofp <command> --help # command-specific options
70
+ ofp --version
71
+ ```
72
+
73
+ `ofp` forwards each subcommand to the corresponding sibling CLI **in-process**,
74
+ so every command keeps its own options, output, and exit codes. `ofp` itself
75
+ adds only routing and a top-level `--help`/`--version`.
76
+
77
+ Each sibling also installs its own standalone command (`ofp-validate`,
78
+ `ofp-schedule`, `ofp-run`); `ofp <command>` is the convenience aggregator.
79
+
80
+ Exit codes: `2` for an unknown/missing command or usage error at the `ofp`
81
+ level; otherwise the subcommand's own exit code is returned unchanged.
82
+
83
+ ## Scope
84
+
85
+ This repository contains only the dispatcher. Behavior, options, and semantics
86
+ live in the sibling repositories linked above. The package is published to PyPI
87
+ as `ofplang`; the `ofplang` import namespace is a PEP 420 namespace shared
88
+ across the organization's tools, and this distribution provides `ofplang.ofp`.
@@ -0,0 +1,10 @@
1
+ ofplang/ofp/__init__.py,sha256=FjUTmSAc-H9ST6jp7jY2U6f6YHv6JZ67Dm7DANdhyFM,80
2
+ ofplang/ofp/__main__.py,sha256=dR2WSC9htXswd3n39fGtOy6zZJfHDDIuB_l3Ro8IPDQ,260
3
+ ofplang/ofp/cli.py,sha256=eRUrBsfjXUSFPloUPFTujweOoWF23XTJETb6rxKKPl0,2827
4
+ ofplang/ofp/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
5
+ ofplang-0.1.0.dist-info/licenses/LICENSE,sha256=weUnWoHlmaiawSjaLy_ECNpyTe7F5vDBfLGJKocpUhI,1071
6
+ ofplang-0.1.0.dist-info/METADATA,sha256=G0MDwDeDbwk2hkC8GSG7-0uuWMWMy7UY5R78rNpcP8Y,3407
7
+ ofplang-0.1.0.dist-info/WHEEL,sha256=K260EYznzXsJYBQGqmI8VTxEdiZYNvDZwW9cBh9-_MA,91
8
+ ofplang-0.1.0.dist-info/entry_points.txt,sha256=tgmKjki1rw4s2el99bLDob3HRUN96Pnb3TsyHDYPLhY,45
9
+ ofplang-0.1.0.dist-info/top_level.txt,sha256=01Lkn2L6B0G7kbUY3KhZc2QhUvSj1NFv5JdrKECQDV0,8
10
+ ofplang-0.1.0.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
+ ofp = ofplang.ofp.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
+ ofplang