determa 0.1.0__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.
- determa-0.1.0/.gitignore +16 -0
- determa-0.1.0/LICENSE +21 -0
- determa-0.1.0/PKG-INFO +72 -0
- determa-0.1.0/README.md +25 -0
- determa-0.1.0/pyproject.toml +52 -0
- determa-0.1.0/src/determa/_cli.py +110 -0
- determa-0.1.0/tests/test_cli.py +63 -0
determa-0.1.0/.gitignore
ADDED
determa-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Christian-Manuel Butzke
|
|
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.
|
determa-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: determa
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Umbrella launcher for the Determa family — git-style dispatch to determa-<product> commands
|
|
5
|
+
Project-URL: Homepage, https://github.com/fruwehq/determa
|
|
6
|
+
Project-URL: Repository, https://github.com/fruwehq/determa
|
|
7
|
+
Project-URL: Issues, https://github.com/fruwehq/determa/issues
|
|
8
|
+
Author: Christian-Manuel Butzke
|
|
9
|
+
License: MIT License
|
|
10
|
+
|
|
11
|
+
Copyright (c) 2026 Christian-Manuel Butzke
|
|
12
|
+
|
|
13
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
14
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
15
|
+
in the Software without restriction, including without limitation the rights
|
|
16
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
17
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
18
|
+
furnished to do so, subject to the following conditions:
|
|
19
|
+
|
|
20
|
+
The above copyright notice and this permission notice shall be included in all
|
|
21
|
+
copies or substantial portions of the Software.
|
|
22
|
+
|
|
23
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
24
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
25
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
26
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
27
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
28
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
29
|
+
SOFTWARE.
|
|
30
|
+
License-File: LICENSE
|
|
31
|
+
Keywords: cli,determa,dispatcher,launcher,statechart
|
|
32
|
+
Classifier: Development Status :: 4 - Beta
|
|
33
|
+
Classifier: Environment :: Console
|
|
34
|
+
Classifier: Intended Audience :: Developers
|
|
35
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
36
|
+
Classifier: Programming Language :: Python :: 3
|
|
37
|
+
Classifier: Topic :: Software Development
|
|
38
|
+
Requires-Python: >=3.9
|
|
39
|
+
Provides-Extra: all
|
|
40
|
+
Requires-Dist: determa-state; extra == 'all'
|
|
41
|
+
Provides-Extra: dev
|
|
42
|
+
Requires-Dist: pytest>=8; extra == 'dev'
|
|
43
|
+
Requires-Dist: ruff; extra == 'dev'
|
|
44
|
+
Provides-Extra: state
|
|
45
|
+
Requires-Dist: determa-state; extra == 'state'
|
|
46
|
+
Description-Content-Type: text/markdown
|
|
47
|
+
|
|
48
|
+
# determa
|
|
49
|
+
|
|
50
|
+
The **umbrella launcher** for the [Determa](https://github.com/fruwehq/determa) family.
|
|
51
|
+
|
|
52
|
+
`determa` is a thin, git-style dispatcher: `determa <product> …` finds and runs the
|
|
53
|
+
`determa-<product>` command on your `PATH`.
|
|
54
|
+
|
|
55
|
+
```console
|
|
56
|
+
$ pip install "determa[state]" # launcher + the statechart engine
|
|
57
|
+
$ determa state run machine.yaml # → determa-state run machine.yaml
|
|
58
|
+
$ determa list # installed products
|
|
59
|
+
$ determa --version
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
- `pip install determa` — just the launcher.
|
|
63
|
+
- `pip install "determa[state]"` — launcher + [`determa-state`](https://pypi.org/project/determa-state/).
|
|
64
|
+
- `pip install "determa[all]"` — launcher + the whole family.
|
|
65
|
+
|
|
66
|
+
The launcher is language-agnostic: it dispatches to whichever `determa-state` is on
|
|
67
|
+
`PATH`, be it the Python or the Rust build. It ships no `determa/__init__.py`, so it
|
|
68
|
+
coexists cleanly with `determa.state` as a PEP 420 namespace.
|
|
69
|
+
|
|
70
|
+
## License
|
|
71
|
+
|
|
72
|
+
MIT
|
determa-0.1.0/README.md
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# determa
|
|
2
|
+
|
|
3
|
+
The **umbrella launcher** for the [Determa](https://github.com/fruwehq/determa) family.
|
|
4
|
+
|
|
5
|
+
`determa` is a thin, git-style dispatcher: `determa <product> …` finds and runs the
|
|
6
|
+
`determa-<product>` command on your `PATH`.
|
|
7
|
+
|
|
8
|
+
```console
|
|
9
|
+
$ pip install "determa[state]" # launcher + the statechart engine
|
|
10
|
+
$ determa state run machine.yaml # → determa-state run machine.yaml
|
|
11
|
+
$ determa list # installed products
|
|
12
|
+
$ determa --version
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
- `pip install determa` — just the launcher.
|
|
16
|
+
- `pip install "determa[state]"` — launcher + [`determa-state`](https://pypi.org/project/determa-state/).
|
|
17
|
+
- `pip install "determa[all]"` — launcher + the whole family.
|
|
18
|
+
|
|
19
|
+
The launcher is language-agnostic: it dispatches to whichever `determa-state` is on
|
|
20
|
+
`PATH`, be it the Python or the Rust build. It ships no `determa/__init__.py`, so it
|
|
21
|
+
coexists cleanly with `determa.state` as a PEP 420 namespace.
|
|
22
|
+
|
|
23
|
+
## License
|
|
24
|
+
|
|
25
|
+
MIT
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "determa"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Umbrella launcher for the Determa family — git-style dispatch to determa-<product> commands"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.9"
|
|
11
|
+
license = { file = "LICENSE" }
|
|
12
|
+
authors = [{ name = "Christian-Manuel Butzke" }]
|
|
13
|
+
keywords = ["determa", "cli", "launcher", "statechart", "dispatcher"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Environment :: Console",
|
|
17
|
+
"Intended Audience :: Developers",
|
|
18
|
+
"License :: OSI Approved :: MIT License",
|
|
19
|
+
"Programming Language :: Python :: 3",
|
|
20
|
+
"Topic :: Software Development",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
# Convenience installs: `pip install "determa[state]"` gets the launcher + the
|
|
25
|
+
# statechart engine; `determa[all]` gets the whole family.
|
|
26
|
+
state = ["determa-state"]
|
|
27
|
+
all = ["determa-state"]
|
|
28
|
+
dev = ["pytest>=8", "ruff"]
|
|
29
|
+
|
|
30
|
+
[project.urls]
|
|
31
|
+
Homepage = "https://github.com/fruwehq/determa"
|
|
32
|
+
Repository = "https://github.com/fruwehq/determa"
|
|
33
|
+
Issues = "https://github.com/fruwehq/determa/issues"
|
|
34
|
+
|
|
35
|
+
[project.scripts]
|
|
36
|
+
determa = "determa._cli:main"
|
|
37
|
+
|
|
38
|
+
# `determa` is a PEP 420 namespace root (no determa/__init__.py) so it can coexist
|
|
39
|
+
# with determa-state's `determa.state` package. Ship only the launcher module.
|
|
40
|
+
[tool.hatch.build.targets.wheel]
|
|
41
|
+
sources = ["src"]
|
|
42
|
+
only-include = ["src/determa/_cli.py"]
|
|
43
|
+
|
|
44
|
+
[tool.ruff]
|
|
45
|
+
line-length = 100
|
|
46
|
+
target-version = "py39"
|
|
47
|
+
|
|
48
|
+
[tool.ruff.lint]
|
|
49
|
+
select = ["E", "F", "I", "UP", "B", "W", "C4"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"""determa — umbrella launcher for the Determa family.
|
|
2
|
+
|
|
3
|
+
A thin, git-style dispatcher: ``determa <product> [args…]`` finds and executes the
|
|
4
|
+
``determa-<product>`` command on ``PATH`` (e.g. ``determa state run m.yaml`` →
|
|
5
|
+
``determa-state run m.yaml``). It is language-agnostic — it dispatches to whichever
|
|
6
|
+
``determa-state`` is installed, be it the Python or the Rust build.
|
|
7
|
+
|
|
8
|
+
This distribution intentionally ships **no** ``determa/__init__.py`` so ``determa``
|
|
9
|
+
stays a PEP 420 namespace root shared with ``determa.state`` and future ``determa.*``
|
|
10
|
+
packages. The launcher lives here as a plain module in that namespace.
|
|
11
|
+
"""
|
|
12
|
+
|
|
13
|
+
from __future__ import annotations
|
|
14
|
+
|
|
15
|
+
import os
|
|
16
|
+
import shutil
|
|
17
|
+
import subprocess
|
|
18
|
+
import sys
|
|
19
|
+
|
|
20
|
+
PREFIX = "determa-"
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
def _version() -> str:
|
|
24
|
+
try:
|
|
25
|
+
from importlib.metadata import version
|
|
26
|
+
|
|
27
|
+
return version("determa")
|
|
28
|
+
except Exception:
|
|
29
|
+
return "0+unknown"
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
def _discover() -> list[str]:
|
|
33
|
+
"""Product subcommands available as ``determa-<name>`` executables on ``PATH``."""
|
|
34
|
+
exts = [e for e in os.environ.get("PATHEXT", "").split(os.pathsep) if e] or [""]
|
|
35
|
+
found: set[str] = set()
|
|
36
|
+
for directory in os.environ.get("PATH", "").split(os.pathsep):
|
|
37
|
+
if not directory or not os.path.isdir(directory):
|
|
38
|
+
continue
|
|
39
|
+
try:
|
|
40
|
+
entries = os.listdir(directory)
|
|
41
|
+
except OSError:
|
|
42
|
+
continue
|
|
43
|
+
for name in entries:
|
|
44
|
+
if not name.startswith(PREFIX):
|
|
45
|
+
continue
|
|
46
|
+
stem = name
|
|
47
|
+
for ext in exts:
|
|
48
|
+
if ext and stem.lower().endswith(ext.lower()):
|
|
49
|
+
stem = stem[: -len(ext)]
|
|
50
|
+
break
|
|
51
|
+
sub = stem[len(PREFIX):]
|
|
52
|
+
if sub:
|
|
53
|
+
found.add(sub)
|
|
54
|
+
return sorted(found)
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _help() -> str:
|
|
58
|
+
lines = [
|
|
59
|
+
f"determa {_version()} — umbrella launcher for the Determa family",
|
|
60
|
+
"",
|
|
61
|
+
"usage: determa <product> [args…]",
|
|
62
|
+
" determa list list installed products",
|
|
63
|
+
" determa --version show this launcher's version",
|
|
64
|
+
"",
|
|
65
|
+
"'determa <product> …' runs the 'determa-<product>' command on PATH,",
|
|
66
|
+
"e.g. 'determa state run m.yaml' → 'determa-state run m.yaml'.",
|
|
67
|
+
"",
|
|
68
|
+
]
|
|
69
|
+
products = _discover()
|
|
70
|
+
if products:
|
|
71
|
+
lines.append("installed products:")
|
|
72
|
+
lines += [f" {p}" for p in products]
|
|
73
|
+
else:
|
|
74
|
+
lines += [
|
|
75
|
+
"no products found on PATH. install one, e.g.:",
|
|
76
|
+
" pip install determa-state",
|
|
77
|
+
]
|
|
78
|
+
return "\n".join(lines)
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def main(argv: list[str] | None = None) -> int:
|
|
82
|
+
args = list(sys.argv[1:] if argv is None else argv)
|
|
83
|
+
if not args or args[0] in ("-h", "--help", "help"):
|
|
84
|
+
print(_help())
|
|
85
|
+
return 0
|
|
86
|
+
if args[0] in ("-V", "--version", "version"):
|
|
87
|
+
print(f"determa {_version()}")
|
|
88
|
+
return 0
|
|
89
|
+
if args[0] == "list":
|
|
90
|
+
for product in _discover():
|
|
91
|
+
print(product)
|
|
92
|
+
return 0
|
|
93
|
+
|
|
94
|
+
sub, rest = args[0], args[1:]
|
|
95
|
+
exe = shutil.which(f"{PREFIX}{sub}")
|
|
96
|
+
if exe is None:
|
|
97
|
+
sys.stderr.write(
|
|
98
|
+
f"determa: unknown product '{sub}' — '{PREFIX}{sub}' not found on PATH.\n"
|
|
99
|
+
f"try 'determa list', or install it (e.g. 'pip install {PREFIX}{sub}').\n"
|
|
100
|
+
)
|
|
101
|
+
return 127
|
|
102
|
+
try:
|
|
103
|
+
return subprocess.call([exe, *rest])
|
|
104
|
+
except OSError as exc: # pragma: no cover - defensive
|
|
105
|
+
sys.stderr.write(f"determa: failed to run {exe}: {exc}\n")
|
|
106
|
+
return 126
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
if __name__ == "__main__":
|
|
110
|
+
raise SystemExit(main())
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"""Unit tests for the determa launcher (dispatch, discovery, help/version)."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import os
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
import pytest
|
|
9
|
+
|
|
10
|
+
import determa._cli as cli
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
def test_help_shows_usage(capsys):
|
|
14
|
+
assert cli.main(["--help"]) == 0
|
|
15
|
+
out = capsys.readouterr().out
|
|
16
|
+
assert "umbrella launcher for the Determa family" in out
|
|
17
|
+
assert "determa <product>" in out
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_no_args_is_help(capsys):
|
|
21
|
+
assert cli.main([]) == 0
|
|
22
|
+
assert "usage: determa" in capsys.readouterr().out
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
def test_version(capsys):
|
|
26
|
+
assert cli.main(["--version"]) == 0
|
|
27
|
+
assert capsys.readouterr().out.startswith("determa ")
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
def test_unknown_product_exits_127(capsys):
|
|
31
|
+
assert cli.main(["definitely-not-real"]) == 127
|
|
32
|
+
assert "not found on PATH" in capsys.readouterr().err
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
@pytest.mark.skipif(sys.platform == "win32", reason="uses a POSIX shell stub")
|
|
36
|
+
def test_dispatches_to_product_on_path(tmp_path, monkeypatch, capfd):
|
|
37
|
+
exe = tmp_path / "determa-echo"
|
|
38
|
+
exe.write_text('#!/bin/sh\necho "echo-product: $*"\nexit 0\n')
|
|
39
|
+
exe.chmod(0o755)
|
|
40
|
+
monkeypatch.setenv("PATH", str(tmp_path) + os.pathsep + os.environ.get("PATH", ""))
|
|
41
|
+
|
|
42
|
+
assert cli.main(["echo", "hello", "world"]) == 0
|
|
43
|
+
assert "echo-product: hello world" in capfd.readouterr().out
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
@pytest.mark.skipif(sys.platform == "win32", reason="uses a POSIX shell stub")
|
|
47
|
+
def test_dispatch_propagates_exit_code(tmp_path, monkeypatch):
|
|
48
|
+
exe = tmp_path / "determa-boom"
|
|
49
|
+
exe.write_text("#!/bin/sh\nexit 3\n")
|
|
50
|
+
exe.chmod(0o755)
|
|
51
|
+
monkeypatch.setenv("PATH", str(tmp_path) + os.pathsep + os.environ.get("PATH", ""))
|
|
52
|
+
assert cli.main(["boom"]) == 3
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
@pytest.mark.skipif(sys.platform == "win32", reason="uses a POSIX shell stub")
|
|
56
|
+
def test_list_discovers_products(tmp_path, monkeypatch, capsys):
|
|
57
|
+
(tmp_path / "determa-alpha").write_text("#!/bin/sh\n")
|
|
58
|
+
(tmp_path / "determa-beta").write_text("#!/bin/sh\n")
|
|
59
|
+
for f in ("determa-alpha", "determa-beta"):
|
|
60
|
+
(tmp_path / f).chmod(0o755)
|
|
61
|
+
monkeypatch.setenv("PATH", str(tmp_path)) # isolate PATH to the stub dir
|
|
62
|
+
assert cli.main(["list"]) == 0
|
|
63
|
+
assert capsys.readouterr().out.split() == ["alpha", "beta"]
|