gramlab 0.1.0a1__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.
gramlab/README.md ADDED
@@ -0,0 +1,6 @@
1
+ # Python core and SDK
2
+
3
+ Reserved for independently written MIT-licensed simulation, Bot API transport, scenario control
4
+ and reporting code. The package exports the experimental typed scenario-authoring interface;
5
+ `runtime.py` implements its Linux process boundary. No stable simulator interface exists yet. Keep Android-derived
6
+ classes and generated client-derived code outside this boundary.
gramlab/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ """GramLab's experimental scenario-authoring interface."""
2
+
3
+ from gramlab.scenario import Scenario, ScenarioError
4
+ from gramlab.scenario_flow import (
5
+ Bot,
6
+ BotState,
7
+ BotStatus,
8
+ Callback,
9
+ Capture,
10
+ Conversation,
11
+ InlineAction,
12
+ InlineButton,
13
+ InteractionReceipt,
14
+ Message,
15
+ ScenarioFlowError,
16
+ ScenarioWaitTimeout,
17
+ User,
18
+ )
19
+
20
+ __all__ = [
21
+ "Bot",
22
+ "BotState",
23
+ "BotStatus",
24
+ "Callback",
25
+ "Capture",
26
+ "Conversation",
27
+ "InlineAction",
28
+ "InlineButton",
29
+ "InteractionReceipt",
30
+ "Message",
31
+ "Scenario",
32
+ "ScenarioError",
33
+ "ScenarioFlowError",
34
+ "ScenarioWaitTimeout",
35
+ "User",
36
+ ]
gramlab/__main__.py ADDED
@@ -0,0 +1,46 @@
1
+ """Public command entry point; consumer code is only executed inside the runtime."""
2
+
3
+ import argparse
4
+ import os
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ from gramlab.runner import run
9
+ from gramlab.runtime import RuntimeProfile
10
+
11
+
12
+ def main() -> int:
13
+ parser = argparse.ArgumentParser(prog="gramlab")
14
+ commands = parser.add_subparsers(dest="command", required=True)
15
+ execute = commands.add_parser("run", help="Run a declared scenario and bots offline")
16
+ execute.add_argument("manifest", type=Path)
17
+ execute.add_argument("--output", type=Path, required=True, help="Fresh run directory")
18
+ execute.add_argument("--profile", type=Path, default=os.environ.get("GRAMLAB_RUNTIME_PROFILE"))
19
+ execute.add_argument(
20
+ "--android-profile", type=Path, default=os.environ.get("GRAMLAB_ANDROID_RUNTIME_PROFILE")
21
+ )
22
+ execute.add_argument("--android-apk", type=Path, default=os.environ.get("GRAMLAB_ANDROID_APK"))
23
+ execute.add_argument("--bridge-version", type=int, choices=(3, 4, 5, 6), default=3)
24
+ args = parser.parse_args()
25
+ if args.profile is None:
26
+ parser.error("Enter the provisioned Nix shell or supply --profile")
27
+ try:
28
+ outcome = run(
29
+ args.manifest,
30
+ args.output,
31
+ profile=RuntimeProfile.load(args.profile),
32
+ android_profile=RuntimeProfile.load(args.android_profile)
33
+ if args.android_profile
34
+ else None,
35
+ android_apk=args.android_apk,
36
+ bridge_version=args.bridge_version,
37
+ )
38
+ except (OSError, ValueError, KeyError, TypeError) as error:
39
+ print(f"gramlab: cannot prepare run ({type(error).__name__}): {error}", file=sys.stderr)
40
+ return 2
41
+ print(f"{outcome}: {args.output / 'report.html'}")
42
+ return 0 if outcome == "passed" else 1
43
+
44
+
45
+ if __name__ == "__main__":
46
+ raise SystemExit(main())