dockflow-cli 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.
dockflow_cli/__init__.py
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Dockflow's lightweight command host; importing this module has no effects."""
|
dockflow_cli/main.py
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
"""Installed-distribution extension discovery and the shared command boundary."""
|
|
2
|
+
|
|
3
|
+
import re
|
|
4
|
+
import sys
|
|
5
|
+
from importlib import metadata
|
|
6
|
+
|
|
7
|
+
import typer
|
|
8
|
+
from typer.main import get_command
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _provider(entry) -> str:
|
|
12
|
+
dist = getattr(entry, "dist", None)
|
|
13
|
+
return f"{dist.name} ({entry.value})" if dist else entry.value
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def create_app() -> typer.Typer:
|
|
17
|
+
app = typer.Typer(
|
|
18
|
+
add_completion=False,
|
|
19
|
+
no_args_is_help=False,
|
|
20
|
+
help="Dockflow — installed workflow tools.",
|
|
21
|
+
pretty_exceptions_enable=False,
|
|
22
|
+
)
|
|
23
|
+
entries = sorted(
|
|
24
|
+
metadata.entry_points(group="dockflow_cli.modules"),
|
|
25
|
+
key=lambda entry: (entry.name, _provider(entry)),
|
|
26
|
+
)
|
|
27
|
+
seen = {}
|
|
28
|
+
for entry in entries:
|
|
29
|
+
if not re.fullmatch(r"[a-z][a-z0-9]*(?:-[a-z0-9]+)*", entry.name):
|
|
30
|
+
raise RuntimeError(f"Invalid module {entry.name!r} from {_provider(entry)}")
|
|
31
|
+
if entry.name in {"help", "version"} or entry.name in seen:
|
|
32
|
+
other = _provider(seen[entry.name]) if entry.name in seen else "built-in"
|
|
33
|
+
raise RuntimeError(
|
|
34
|
+
f"Module {entry.name!r} conflicts: {_provider(entry)} and {other}"
|
|
35
|
+
)
|
|
36
|
+
seen[entry.name] = entry
|
|
37
|
+
for entry in entries:
|
|
38
|
+
try:
|
|
39
|
+
plugin = entry.load()
|
|
40
|
+
if not isinstance(plugin, typer.Typer):
|
|
41
|
+
raise TypeError("entry point must export a typer.Typer instance")
|
|
42
|
+
get_command(plugin)
|
|
43
|
+
app.add_typer(plugin, name=entry.name)
|
|
44
|
+
except Exception as exc:
|
|
45
|
+
raise RuntimeError(
|
|
46
|
+
f"Cannot load module {entry.name!r} from {_provider(entry)}: {exc}"
|
|
47
|
+
) from exc
|
|
48
|
+
|
|
49
|
+
@app.callback(invoke_without_command=True)
|
|
50
|
+
def root(
|
|
51
|
+
ctx: typer.Context,
|
|
52
|
+
version: bool = typer.Option(
|
|
53
|
+
False, "--version", help="Show the installed Dockflow version."
|
|
54
|
+
),
|
|
55
|
+
):
|
|
56
|
+
if ctx.invoked_subcommand is None:
|
|
57
|
+
typer.echo(ctx.get_help())
|
|
58
|
+
if not entries:
|
|
59
|
+
typer.echo(
|
|
60
|
+
"Install a Dockflow feature package in this Python environment "
|
|
61
|
+
"to add command groups."
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
return app
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
def main() -> None:
|
|
68
|
+
"""Run the console host, preserving deliberate command exit statuses."""
|
|
69
|
+
# Root options precede module words. Never discover providers for --version.
|
|
70
|
+
root_args = sys.argv[1:]
|
|
71
|
+
if root_args and root_args[0] == "--version":
|
|
72
|
+
if len(root_args) != 1:
|
|
73
|
+
typer.echo("--version does not accept command arguments", err=True)
|
|
74
|
+
raise SystemExit(2)
|
|
75
|
+
try:
|
|
76
|
+
typer.echo(f"dockflow {metadata.version('dockflow-cli')}")
|
|
77
|
+
except metadata.PackageNotFoundError:
|
|
78
|
+
typer.echo(
|
|
79
|
+
"dockflow-cli metadata is missing; reinstall dockflow-cli", err=True
|
|
80
|
+
)
|
|
81
|
+
raise SystemExit(1) from None
|
|
82
|
+
return
|
|
83
|
+
try:
|
|
84
|
+
create_app()()
|
|
85
|
+
except (SystemExit, KeyboardInterrupt):
|
|
86
|
+
raise
|
|
87
|
+
except Exception as exc:
|
|
88
|
+
typer.echo(f"Dockflow: {exc}", err=True)
|
|
89
|
+
raise SystemExit(1) from None
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
if __name__ == "__main__":
|
|
93
|
+
main()
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dockflow-cli
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Dockflow extensible command host
|
|
5
|
+
License-Expression: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Requires-Dist: typer>=0.27.3,<0.28.0
|
|
8
|
+
Requires-Python: >=3.12
|
|
9
|
+
Project-URL: Homepage, https://github.com/dockflow-project/dockflow
|
|
10
|
+
Project-URL: Documentation, https://github.com/dockflow-project/dockflow/blob/main/docs/README.md
|
|
11
|
+
Project-URL: Issues, https://github.com/dockflow-project/dockflow/issues
|
|
12
|
+
Project-URL: Changelog, https://github.com/dockflow-project/dockflow/blob/main/CHANGELOG.md
|
|
13
|
+
Description-Content-Type: text/markdown
|
|
14
|
+
|
|
15
|
+
# Dockflow CLI
|
|
16
|
+
|
|
17
|
+
`dockflow-cli` supplies the shared `dockflow` executable. Installed feature
|
|
18
|
+
packages register Typer applications through the `dockflow_cli.modules` Python
|
|
19
|
+
entry-point group; `dockflow-pipelines` supplies the `pipelines` commands.
|
|
20
|
+
|
|
21
|
+
```text
|
|
22
|
+
dockflow --help
|
|
23
|
+
dockflow --version
|
|
24
|
+
dockflow pipelines --help
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Help/version requests are offline. Installing this package alone does not start
|
|
28
|
+
services, install feature modules or contact a registry. The command host reports
|
|
29
|
+
invalid or conflicting plugin registrations rather than silently omitting them.
|
|
30
|
+
|
|
31
|
+
Install the command host with Python 3.12 or newer:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install dockflow-cli==0.1.0
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Installing `dockflow-pipelines==0.1.0` also installs this matching host.
|
|
38
|
+
MIT licensed. See [installation](https://github.com/dockflow-project/dockflow/blob/main/docs/installation.md),
|
|
39
|
+
[CLI usage](https://github.com/dockflow-project/dockflow/blob/main/docs/cli.md) and the [contribution guide](https://github.com/dockflow-project/dockflow/blob/main/CONTRIBUTING.md).
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
dockflow_cli/__init__.py,sha256=jl7k7JP7yrWqG8clLU8GHAYbNEMYxbvufmDAo-aDKQc,81
|
|
2
|
+
dockflow_cli/main.py,sha256=wVPii88KL5hex7VkCr_ohCG-JvYvsnztC6zDFsbSP_E,3154
|
|
3
|
+
dockflow_cli-0.1.0.dist-info/licenses/LICENSE,sha256=uIXEE60dM30LHZXUm4HhF2tw0Zy02FRsqdapPi9x1tI,1078
|
|
4
|
+
dockflow_cli-0.1.0.dist-info/WHEEL,sha256=a0ta4TK7UKMB0EbDesmi2mn0Djkly7aj_7Tu2R7SseE,81
|
|
5
|
+
dockflow_cli-0.1.0.dist-info/entry_points.txt,sha256=o8Jo9AwxBGao5sxg8VnzckRbt1RQc5Wq3ODQ71w6tDM,53
|
|
6
|
+
dockflow_cli-0.1.0.dist-info/METADATA,sha256=XzjN1fgx-aY0c3QDeQ203af_wKU2C_avgw2wAx_AbAA,1605
|
|
7
|
+
dockflow_cli-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dockflow contributors
|
|
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.
|