aws-analyzer 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.
- aws_analyzer/__init__.py +89 -0
- aws_analyzer/bedrock_chat.py +4526 -0
- aws_analyzer/bedrock_kb.py +6029 -0
- aws_analyzer/dynamodb.py +4193 -0
- aws_analyzer/py.typed +0 -0
- aws_analyzer/s3.py +10832 -0
- aws_analyzer/s3_explorer.py +1316 -0
- aws_analyzer/sagemaker_env.py +4473 -0
- aws_analyzer-0.1.0.dist-info/METADATA +1319 -0
- aws_analyzer-0.1.0.dist-info/RECORD +12 -0
- aws_analyzer-0.1.0.dist-info/WHEEL +4 -0
- aws_analyzer-0.1.0.dist-info/licenses/LICENSE +201 -0
aws_analyzer/__init__.py
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"""
|
|
2
|
+
aws-analyzer - readable reports on your S3 buckets, DynamoDB tables, Bedrock knowledge bases and SageMaker
|
|
3
|
+
notebooks, from a SageMaker / Jupyter notebook.
|
|
4
|
+
|
|
5
|
+
This is the pip-installed form of the files in the repository's analyzers/ folder: each module here is one of
|
|
6
|
+
those files, unchanged, so it works the same as a copy next to your notebook. Only the import line differs.
|
|
7
|
+
|
|
8
|
+
Quick start
|
|
9
|
+
-----------
|
|
10
|
+
%pip install aws-analyzer # only boto3 is required; aws-analyzer[all] adds every optional package
|
|
11
|
+
|
|
12
|
+
from aws_analyzer import S3View # or DynamoDBView, BedrockKBView, SageMakerView, S3Explorer
|
|
13
|
+
ui = S3View()
|
|
14
|
+
ui.help() # every command, grouped by task
|
|
15
|
+
|
|
16
|
+
from aws_analyzer import chat # a chat window on a Bedrock knowledge base
|
|
17
|
+
chat("support-docs", model="sonnet")
|
|
18
|
+
|
|
19
|
+
from aws_analyzer.s3 import human_size # anything else in a module: aws_analyzer.<module>
|
|
20
|
+
|
|
21
|
+
Modules: s3, s3_explorer, dynamodb, bedrock_kb, bedrock_chat, sagemaker_env. Importing this package loads none of them; each
|
|
22
|
+
loads the first time one of its names is used.
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import importlib
|
|
28
|
+
from typing import TYPE_CHECKING, Any
|
|
29
|
+
|
|
30
|
+
# For editors and type checkers; at run time __getattr__ imports them on first use. The modules are analyzers/*.py,
|
|
31
|
+
# which the build copies in here (pyproject.toml), so in the repository itself these imports don't resolve.
|
|
32
|
+
# pyright: reportMissingImports=false
|
|
33
|
+
if TYPE_CHECKING:
|
|
34
|
+
from .bedrock_chat import BedrockChatAnalyzer, BedrockChatView, chat
|
|
35
|
+
from .bedrock_kb import BedrockKBAnalyzer, BedrockKBView
|
|
36
|
+
from .dynamodb import DynamoDBAnalyzer, DynamoDBView
|
|
37
|
+
from .s3 import S3Analyzer, S3View
|
|
38
|
+
from .s3_explorer import S3Explorer, S3Navigator
|
|
39
|
+
from .sagemaker_env import SageMakerAnalyzer, SageMakerView
|
|
40
|
+
|
|
41
|
+
__version__ = "0.1.0"
|
|
42
|
+
|
|
43
|
+
__all__ = [
|
|
44
|
+
"__version__",
|
|
45
|
+
"S3Analyzer",
|
|
46
|
+
"S3View",
|
|
47
|
+
"S3Explorer",
|
|
48
|
+
"S3Navigator",
|
|
49
|
+
"DynamoDBAnalyzer",
|
|
50
|
+
"DynamoDBView",
|
|
51
|
+
"BedrockKBAnalyzer",
|
|
52
|
+
"BedrockKBView",
|
|
53
|
+
"BedrockChatAnalyzer",
|
|
54
|
+
"BedrockChatView",
|
|
55
|
+
"chat",
|
|
56
|
+
"SageMakerAnalyzer",
|
|
57
|
+
"SageMakerView",
|
|
58
|
+
]
|
|
59
|
+
_EXPORTS = { # name -> the module it comes from
|
|
60
|
+
"S3Analyzer": "s3",
|
|
61
|
+
"S3View": "s3",
|
|
62
|
+
"S3Explorer": "s3_explorer",
|
|
63
|
+
"S3Navigator": "s3_explorer",
|
|
64
|
+
"DynamoDBAnalyzer": "dynamodb",
|
|
65
|
+
"DynamoDBView": "dynamodb",
|
|
66
|
+
"BedrockKBAnalyzer": "bedrock_kb",
|
|
67
|
+
"BedrockKBView": "bedrock_kb",
|
|
68
|
+
"BedrockChatAnalyzer": "bedrock_chat",
|
|
69
|
+
"BedrockChatView": "bedrock_chat",
|
|
70
|
+
"chat": "bedrock_chat",
|
|
71
|
+
"SageMakerAnalyzer": "sagemaker_env",
|
|
72
|
+
"SageMakerView": "sagemaker_env",
|
|
73
|
+
}
|
|
74
|
+
_MODULES = ("s3", "s3_explorer", "dynamodb", "bedrock_kb", "bedrock_chat", "sagemaker_env")
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
def __getattr__(name: str) -> Any:
|
|
78
|
+
if name in _EXPORTS:
|
|
79
|
+
value = getattr(importlib.import_module(f"{__name__}.{_EXPORTS[name]}"), name)
|
|
80
|
+
elif name in _MODULES:
|
|
81
|
+
value = importlib.import_module(f"{__name__}.{name}")
|
|
82
|
+
else:
|
|
83
|
+
raise AttributeError(f"module {__name__!r} has no attribute {name!r}")
|
|
84
|
+
globals()[name] = value # later lookups skip __getattr__
|
|
85
|
+
return value
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
def __dir__() -> list[str]:
|
|
89
|
+
return sorted({*globals(), *_EXPORTS, *_MODULES})
|