edutin-toolkit 1.5.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.
- aws_toolkit/__init__.py +3 -0
- aws_toolkit/__main__.py +5 -0
- aws_toolkit/_bundled_templates/python312_arm64/code_template/main.py +7 -0
- aws_toolkit/_bundled_templates/python312_arm64/template.json +10 -0
- aws_toolkit/_bundled_vscode/lambda-test-runner-0.3.1.vsix +0 -0
- aws_toolkit/cli.py +173 -0
- aws_toolkit/commands/__init__.py +1 -0
- aws_toolkit/commands/_shared.py +646 -0
- aws_toolkit/commands/config.py +351 -0
- aws_toolkit/commands/dynamodb_doc.py +159 -0
- aws_toolkit/commands/init.py +676 -0
- aws_toolkit/commands/install_vscode_extension.py +185 -0
- aws_toolkit/commands/lambda_create.py +376 -0
- aws_toolkit/commands/lambda_deploy.py +309 -0
- aws_toolkit/commands/lambda_download.py +226 -0
- aws_toolkit/commands/lambda_download_all.py +343 -0
- aws_toolkit/commands/lambda_download_tests.py +321 -0
- aws_toolkit/commands/lambda_explorer.py +585 -0
- aws_toolkit/commands/lambda_layer_doc.py +107 -0
- aws_toolkit/commands/lambda_publish_version.py +231 -0
- aws_toolkit/commands/lambda_test.py +582 -0
- aws_toolkit/config_resolver.py +387 -0
- edutin_toolkit-1.5.0.dist-info/METADATA +68 -0
- edutin_toolkit-1.5.0.dist-info/RECORD +28 -0
- edutin_toolkit-1.5.0.dist-info/WHEEL +5 -0
- edutin_toolkit-1.5.0.dist-info/entry_points.txt +2 -0
- edutin_toolkit-1.5.0.dist-info/licenses/LICENSE +21 -0
- edutin_toolkit-1.5.0.dist-info/top_level.txt +1 -0
aws_toolkit/__init__.py
ADDED
aws_toolkit/__main__.py
ADDED
|
Binary file
|
aws_toolkit/cli.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""AWS Toolkit – unified CLI dispatcher."""
|
|
3
|
+
|
|
4
|
+
import sys
|
|
5
|
+
import importlib
|
|
6
|
+
|
|
7
|
+
COMMANDS = {
|
|
8
|
+
"init": {
|
|
9
|
+
"desc": "Initialize the current directory as an aws-toolkit project",
|
|
10
|
+
"usage": "etk init [--template <n>] [--lambdas <p>] [--layers <p>] [--dynamo <p>] [--author <n>] [--profile <p>] [--sandbox <l>] [--force] [-ai]",
|
|
11
|
+
"module": "aws_toolkit.commands.init",
|
|
12
|
+
},
|
|
13
|
+
"lambda_explorer": {
|
|
14
|
+
"desc": "Interactive TUI to browse, search and download Lambda functions",
|
|
15
|
+
"usage": "etk lambda_explorer [-ai [query]]",
|
|
16
|
+
"module": "aws_toolkit.commands.lambda_explorer",
|
|
17
|
+
},
|
|
18
|
+
"lambda_download": {
|
|
19
|
+
"desc": "Download a Lambda function by name",
|
|
20
|
+
"usage": "etk lambda_download <function_name> [-ai]",
|
|
21
|
+
"module": "aws_toolkit.commands.lambda_download",
|
|
22
|
+
},
|
|
23
|
+
"lambda_download_all": {
|
|
24
|
+
"desc": "Bulk download every accessible Lambda (idempotent, parallel)",
|
|
25
|
+
"usage": "etk lambda_download_all [--filter <pat>] [--force] [--dry-run] [--workers N] [-ai]",
|
|
26
|
+
"module": "aws_toolkit.commands.lambda_download_all",
|
|
27
|
+
},
|
|
28
|
+
"dynamodb_doc": {
|
|
29
|
+
"desc": "Document DynamoDB table schemas to JSON files",
|
|
30
|
+
"usage": "etk dynamodb_doc [-ai] | etk dynamodb_doc <table_name> [-ai]",
|
|
31
|
+
"module": "aws_toolkit.commands.dynamodb_doc",
|
|
32
|
+
},
|
|
33
|
+
"lambda_create": {
|
|
34
|
+
"desc": "Create a Lambda function from a template",
|
|
35
|
+
"usage": "etk lambda_create <function_name> [--template <name>] [-ai]",
|
|
36
|
+
"module": "aws_toolkit.commands.lambda_create",
|
|
37
|
+
},
|
|
38
|
+
"lambda_deploy": {
|
|
39
|
+
"desc": "Deploy local code and lambda_config.json to AWS",
|
|
40
|
+
"usage": "etk lambda_deploy <function_name> [-ai]",
|
|
41
|
+
"module": "aws_toolkit.commands.lambda_deploy",
|
|
42
|
+
},
|
|
43
|
+
"lambda_test": {
|
|
44
|
+
"desc": "Deploy source lambda to test lambda and invoke it with an event",
|
|
45
|
+
"usage": "etk lambda_test <function_name> <event_name> [-ai]",
|
|
46
|
+
"module": "aws_toolkit.commands.lambda_test",
|
|
47
|
+
},
|
|
48
|
+
"lambda_download_tests": {
|
|
49
|
+
"desc": "Download shareable test events from AWS into event_tests/",
|
|
50
|
+
"usage": "etk lambda_download_tests <function_name> [-ai]",
|
|
51
|
+
"module": "aws_toolkit.commands.lambda_download_tests",
|
|
52
|
+
},
|
|
53
|
+
"lambda_publish_version": {
|
|
54
|
+
"desc": "Publish a new version of a Lambda from $LATEST (optionally aliasing it as `current`)",
|
|
55
|
+
"usage": "etk lambda_publish_version <name> <description> [--prod] [-ai]",
|
|
56
|
+
"module": "aws_toolkit.commands.lambda_publish_version",
|
|
57
|
+
},
|
|
58
|
+
"lambda_layer_doc": {
|
|
59
|
+
"desc": "Download and document Lambda layer versions (top 3 most recent)",
|
|
60
|
+
"usage": "etk lambda_layer_doc [layer_name] [-ai]",
|
|
61
|
+
"module": "aws_toolkit.commands.lambda_layer_doc",
|
|
62
|
+
},
|
|
63
|
+
"config": {
|
|
64
|
+
"desc": "Create / modify toolkit configuration",
|
|
65
|
+
"usage": "etk config [-ai] | etk config set <key> <value> [-ai]",
|
|
66
|
+
"module": "aws_toolkit.commands.config",
|
|
67
|
+
},
|
|
68
|
+
"install_vscode_extension": {
|
|
69
|
+
"desc": "Install the bundled VSCode extension (▶/☁⬆ buttons on lambda files)",
|
|
70
|
+
"usage": "etk install_vscode_extension [-ai]",
|
|
71
|
+
"module": "aws_toolkit.commands.install_vscode_extension",
|
|
72
|
+
},
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
def _make_commands_table(title: str, commands: dict, T, box):
|
|
76
|
+
from rich.table import Table
|
|
77
|
+
tbl = Table(
|
|
78
|
+
show_header=True,
|
|
79
|
+
header_style=T.HEADER_ST,
|
|
80
|
+
border_style=T.BORDER,
|
|
81
|
+
box=box.DOUBLE_EDGE,
|
|
82
|
+
title=title,
|
|
83
|
+
title_style=T.TITLE,
|
|
84
|
+
padding=(0, 2),
|
|
85
|
+
)
|
|
86
|
+
tbl.add_column("COMMAND", style=f"bold {T.NEON_GREEN}", min_width=20)
|
|
87
|
+
tbl.add_column("DESCRIPTION", style=T.NORMAL, min_width=30)
|
|
88
|
+
tbl.add_column("USAGE", style=T.DIM_STYLE, min_width=45)
|
|
89
|
+
for name, info in commands.items():
|
|
90
|
+
tbl.add_row(name, info["desc"], info["usage"])
|
|
91
|
+
return tbl
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
def show_help():
|
|
95
|
+
from aws_toolkit.commands._shared import console, Theme as T
|
|
96
|
+
from rich.align import Align
|
|
97
|
+
from rich import box
|
|
98
|
+
|
|
99
|
+
console.print()
|
|
100
|
+
console.print(f"[bold {T.CYAN}]AWS TOOLKIT[/bold {T.CYAN}]")
|
|
101
|
+
console.print(f" [{T.DIM_STYLE}]Usage: etk <command> [args][/{T.DIM_STYLE}]")
|
|
102
|
+
console.print()
|
|
103
|
+
|
|
104
|
+
console.print(Align.center(_make_commands_table(
|
|
105
|
+
f"[{T.CYAN}]《 COMMANDS 》[/{T.CYAN}]", COMMANDS, T, box
|
|
106
|
+
)))
|
|
107
|
+
|
|
108
|
+
console.print()
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
def _check_config(ai_mode: bool) -> None:
|
|
112
|
+
"""Force config resolution to surface a clear error before the command runs.
|
|
113
|
+
|
|
114
|
+
ConfigError subclasses (RepoRootNotFound, ProjectConfigMissingField,
|
|
115
|
+
UserConfigMissingField, etc.) are caught by the dispatcher's
|
|
116
|
+
try/except and produce a consistent error code in -ai mode.
|
|
117
|
+
"""
|
|
118
|
+
from aws_toolkit.config_resolver import resolve_config
|
|
119
|
+
resolve_config()
|
|
120
|
+
|
|
121
|
+
|
|
122
|
+
def main():
|
|
123
|
+
args = sys.argv[1:]
|
|
124
|
+
|
|
125
|
+
if not args or args[0] in ("--help", "-h", "help"):
|
|
126
|
+
show_help()
|
|
127
|
+
return
|
|
128
|
+
|
|
129
|
+
cmd = args[0]
|
|
130
|
+
rest = args[1:]
|
|
131
|
+
ai_mode = "-ai" in rest
|
|
132
|
+
|
|
133
|
+
if cmd not in COMMANDS:
|
|
134
|
+
from aws_toolkit.commands._shared import die
|
|
135
|
+
die(
|
|
136
|
+
f"Unknown command: [bold]{cmd}[/bold]\n\n"
|
|
137
|
+
f" Run [bold]etk --help[/bold] to see available commands."
|
|
138
|
+
)
|
|
139
|
+
|
|
140
|
+
from aws_toolkit.commands._shared import log_command
|
|
141
|
+
from aws_toolkit.config_resolver import ConfigError
|
|
142
|
+
|
|
143
|
+
entry = COMMANDS[cmd]
|
|
144
|
+
|
|
145
|
+
try:
|
|
146
|
+
mod = importlib.import_module(entry["module"])
|
|
147
|
+
|
|
148
|
+
if cmd not in ("config", "init", "install_vscode_extension"):
|
|
149
|
+
_check_config(ai_mode=ai_mode)
|
|
150
|
+
detail = mod.main(rest) or ""
|
|
151
|
+
log_command(cmd, rest, "SUCCESS", detail)
|
|
152
|
+
except ConfigError as exc:
|
|
153
|
+
log_command(cmd, rest, "ERROR", f"config_error={exc.code}")
|
|
154
|
+
if ai_mode:
|
|
155
|
+
print(f"error\t{exc.code}\t{exc}", file=sys.stderr)
|
|
156
|
+
sys.exit(1)
|
|
157
|
+
else:
|
|
158
|
+
from aws_toolkit.commands._shared import die as _die
|
|
159
|
+
_die(str(exc)) # exits with code 1
|
|
160
|
+
except SystemExit as exc:
|
|
161
|
+
code = exc.code if exc.code is not None else 0
|
|
162
|
+
if code == 0:
|
|
163
|
+
log_command(cmd, rest, "SUCCESS")
|
|
164
|
+
else:
|
|
165
|
+
log_command(cmd, rest, "ERROR", f"exit_code={code}")
|
|
166
|
+
raise
|
|
167
|
+
except Exception as exc:
|
|
168
|
+
log_command(cmd, rest, "ERROR", f"exception={type(exc).__name__}: {exc}")
|
|
169
|
+
raise
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
if __name__ == "__main__":
|
|
173
|
+
main()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"""Subcomandos de la CLI (p. ej. lambda_explorer)."""
|