osbot-utils 2.72.0__py3-none-any.whl → 2.73.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.
osbot_utils/version CHANGED
@@ -1 +1 @@
1
- v2.72.0
1
+ v2.73.0
@@ -0,0 +1,212 @@
1
+ Metadata-Version: 2.3
2
+ Name: osbot_utils
3
+ Version: 2.73.0
4
+ Summary: OWASP Security Bot - Utils
5
+ License: MIT
6
+ Author: Dinis Cruz
7
+ Author-email: dinis.cruz@owasp.org
8
+ Requires-Python: >=3.7,<4.0
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.7
12
+ Classifier: Programming Language :: Python :: 3.8
13
+ Classifier: Programming Language :: Python :: 3.9
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Project-URL: Homepage, https://github.com/owasp-sbot/OSBot-Utils
19
+ Project-URL: Repository, https://github.com/owasp-sbot/OSBot-Utils
20
+ Description-Content-Type: text/markdown
21
+
22
+ # OSBot-Utils
23
+
24
+ ![Current Release](https://img.shields.io/badge/release-v2.73.0-blue)
25
+ ![Python](https://img.shields.io/badge/python-3.8+-green)
26
+ ![Type-Safe](https://img.shields.io/badge/Type--Safe-✓-brightgreen)
27
+ ![Caching](https://img.shields.io/badge/Caching-Built--In-orange)
28
+ [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
29
+
30
+ A comprehensive Python utility toolkit providing **Type-Safe primitives**, decorators, caching layers, HTML/AST helpers, SQLite tooling, SSH execution, LLM request pipelines, tracing, and more — all designed to accelerate building robust, maintainable automation and integration code.
31
+
32
+ ---
33
+
34
+ ## ✨ Key Features
35
+
36
+ * **🛡️ Type-Safe First**: Strongly typed primitives (`Safe_Str`, `Safe_Int`, `Safe_Float`, etc.) with validation and sanitization
37
+ * **⚡ Multi-layer Caching**: In-memory, per-instance, pickle-on-disk, temp-file, and request/response caches
38
+ * **🗂️ Rich Utilities**: Helpers for HTML parsing/rendering, AST inspection, SSH/SCP execution, SQLite schema management, and more
39
+ * **🧠 LLM Support**: Structured request builders, OpenAI API integration, schema enforcement, and persistent cache
40
+ * **🔍 Tracing & Debugging**: Full function call tracing with configurable depth, locals capture, and pretty output
41
+ * **🧪 Testing Utilities**: Temp SQLite DBs, mockable caches, and easy test helpers
42
+
43
+ ---
44
+
45
+ ## 📦 Installation
46
+
47
+ ```bash
48
+ pip install osbot-utils
49
+ ```
50
+
51
+ From source:
52
+
53
+ ```bash
54
+ pip install git+https://github.com/owasp-sbot/OSBot-Utils.git@dev
55
+ ```
56
+
57
+ ---
58
+
59
+ ## 🚀 Quick Start
60
+
61
+ ### Using Type-Safe Primitives
62
+
63
+ ```python
64
+ from osbot_utils.helpers.safe_str.Safe_Str import Safe_Str
65
+
66
+ class Username(Safe_Str):
67
+ max_length = 20
68
+
69
+ print(Username("alice")) # 'alice'
70
+ print(Username("invalid username!")) # 'invalid_username_'
71
+ ```
72
+
73
+ ---
74
+
75
+ ### Simple In-Memory Caching
76
+
77
+ ```python
78
+ from osbot_utils.decorators.methods.cache_on_self import cache_on_self
79
+
80
+ class DataFetcher:
81
+ @cache_on_self
82
+ def fetch(self, x):
83
+ print("Fetching…")
84
+ return x * 2
85
+
86
+ fetcher = DataFetcher()
87
+ fetcher.fetch(10) # Calls method
88
+ fetcher.fetch(10) # Returns cached result
89
+ ```
90
+
91
+ ---
92
+
93
+ ### HTML Parsing
94
+
95
+ ```python
96
+ from osbot_utils.helpers.html.Html__To__Html_Dict import html_to_dict
97
+
98
+ html_code = "<html><body><h1>Hello</h1></body></html>"
99
+ print(html_to_dict(html_code))
100
+ ```
101
+
102
+ ---
103
+
104
+ ### SQLite Dynamic Table
105
+
106
+ ```python
107
+ from osbot_utils.helpers.sqlite.Temp_Sqlite__Table import Temp_Sqlite__Table
108
+
109
+ with Temp_Sqlite__Table() as table:
110
+ table.row_schema = type("Row", (), {"name": str, "age": int})
111
+ table.create()
112
+ table.add_row_and_commit(name="Alice", age=30)
113
+ print(table.rows())
114
+ ```
115
+
116
+ ---
117
+
118
+ ### LLM Request Execution
119
+
120
+ ```python
121
+ from osbot_utils.helpers.llms.builders.LLM_Request__Builder__Open_AI import LLM_Request__Builder__Open_AI
122
+ from osbot_utils.helpers.llms.actions.LLM_Request__Execute import LLM_Request__Execute
123
+
124
+ builder = LLM_Request__Builder__Open_AI()
125
+ builder.set__model__gpt_4o().add_message__user("Say hi in JSON")
126
+
127
+ executor = LLM_Request__Execute(request_builder=builder)
128
+ response = executor.execute(builder.llm_request())
129
+ print(response.response_data)
130
+ ```
131
+
132
+ ---
133
+
134
+ ## 🏗️ Architecture
135
+
136
+ OSBot-Utils is organized into core **Type-Safe foundations** with layered utilities for different domains:
137
+
138
+ ```
139
+ ┌──────────────────────────────────────────────┐
140
+ │ Your Code │
141
+ │ ┌───────────┐ ┌─────────────┐ ┌──────────┐ │
142
+ │ │ Type-Safe │ │ Decorators │ │ Helpers │ │
143
+ │ │ Primitives│ │ & Caching │ │ (HTML, │ │
144
+ │ │ │ │ │ │ AST, │ │
145
+ │ │ │ │ │ │ SQLite)│ │
146
+ │ └───────────┘ └─────────────┘ └──────────┘ │
147
+ └──────────────────────────┬───────────────────┘
148
+
149
+ ┌──────────────────────────▼───────────────────┐
150
+ │ OSBot-Utils │
151
+ │ ┌────────────────────────────────────────┐ │
152
+ │ │ Type-Safe Core Classes │ │
153
+ │ │ Validation / Sanitization / Defaults │ │
154
+ │ └────────────────────────────────────────┘ │
155
+ │ ┌────────────────────────────────────────┐ │
156
+ │ │ Caching Layers & Decorators │ │
157
+ │ │ @cache, @cache_on_self, pickle, tmp │ │
158
+ │ └────────────────────────────────────────┘ │
159
+ │ ┌────────────────────────────────────────┐ │
160
+ │ │ Domain Helpers │ │
161
+ │ │ HTML, AST, SSH, LLMs, SQLite, Tracing │ │
162
+ │ └────────────────────────────────────────┘ │
163
+ └──────────────────────────────────────────────┘
164
+ ```
165
+
166
+ ---
167
+
168
+ ## 📚 Key Modules
169
+
170
+ * **`helpers/safe_*`** — Type-Safe primitives for validated strings, ints, floats
171
+ * **`decorators/methods`** — Caching, exception capture, timing, validation
172
+ * **`helpers/html`** — HTML ↔ dict ↔ tag classes
173
+ * **`helpers/ast`** — Python AST parsing, visiting, merging
174
+ * **`helpers/sqlite`** — High-level SQLite APIs, schema generation, temp DBs
175
+ * **`helpers/ssh`** — SSH/SCP execution with caching
176
+ * **`helpers/llms`** — LLM request/response handling with caching
177
+ * **`helpers/trace`** — Function call tracing with configurable output
178
+
179
+ ---
180
+
181
+ ## 🎯 Benefits
182
+
183
+ ### For Developers
184
+
185
+ * Strong runtime type validation with Type-Safe classes
186
+ * Consistent patterns for caching and decorators
187
+ * Rich helper library to avoid reinventing the wheel
188
+
189
+ ### For Production
190
+
191
+ * Deterministic caching with persistence options
192
+ * Safe, validated data structures at integration boundaries
193
+ * Lightweight, dependency-minimal utilities
194
+
195
+ ### For Teams
196
+
197
+ * Standardized approach to cross-cutting concerns (logging, tracing, caching)
198
+ * Modular helpers to fit many contexts (CLI, web apps, serverless)
199
+
200
+ ---
201
+
202
+ ## 🤝 Contributing
203
+
204
+ Pull requests are welcome!
205
+ Check existing patterns in `/helpers` and `/decorators` for style guidance.
206
+
207
+ ---
208
+
209
+ ## 📄 License
210
+
211
+ Licensed under the Apache 2.0 License.
212
+
@@ -438,8 +438,8 @@ osbot_utils/utils/Toml.py,sha256=Rxl8gx7mni5CvBAK-Ai02EKw-GwtJdd3yeHT2kMloik,166
438
438
  osbot_utils/utils/Version.py,sha256=Ww6ChwTxqp1QAcxOnztkTicShlcx6fbNsWX5xausHrg,422
439
439
  osbot_utils/utils/Zip.py,sha256=mG42lgTY0tnm14T3P1-DSAIZKkTiYoO3odZ1aOUdc1I,14394
440
440
  osbot_utils/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
441
- osbot_utils/version,sha256=1eUSnZS1NrxKYnn4j42roLYeJRZQpAc7FWBHRLb89U8,8
442
- osbot_utils-2.72.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
443
- osbot_utils-2.72.0.dist-info/METADATA,sha256=eVxoScUD2rZxodwibj4wdrTxwWrOfI7MwsNjoEZBaJ0,1329
444
- osbot_utils-2.72.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
445
- osbot_utils-2.72.0.dist-info/RECORD,,
441
+ osbot_utils/version,sha256=VCxgw8bSna_rDix4JFMV7Wb8rA3m_O27X41oEA5IP7c,8
442
+ osbot_utils-2.73.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
443
+ osbot_utils-2.73.0.dist-info/METADATA,sha256=XGCwVDdvQ37eGSObzfovrfDGt-F4hJNsXsyeyRYh5X4,7892
444
+ osbot_utils-2.73.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
445
+ osbot_utils-2.73.0.dist-info/RECORD,,
@@ -1,44 +0,0 @@
1
- Metadata-Version: 2.3
2
- Name: osbot_utils
3
- Version: 2.72.0
4
- Summary: OWASP Security Bot - Utils
5
- License: MIT
6
- Author: Dinis Cruz
7
- Author-email: dinis.cruz@owasp.org
8
- Requires-Python: >=3.7,<4.0
9
- Classifier: License :: OSI Approved :: MIT License
10
- Classifier: Programming Language :: Python :: 3
11
- Classifier: Programming Language :: Python :: 3.7
12
- Classifier: Programming Language :: Python :: 3.8
13
- Classifier: Programming Language :: Python :: 3.9
14
- Classifier: Programming Language :: Python :: 3.10
15
- Classifier: Programming Language :: Python :: 3.11
16
- Classifier: Programming Language :: Python :: 3.12
17
- Classifier: Programming Language :: Python :: 3.13
18
- Project-URL: Homepage, https://github.com/owasp-sbot/OSBot-Utils
19
- Project-URL: Repository, https://github.com/owasp-sbot/OSBot-Utils
20
- Description-Content-Type: text/markdown
21
-
22
- # OSBot-Utils
23
-
24
- Powerful Python util methods and classes that simplify common apis and tasks.
25
-
26
- ![Current Release](https://img.shields.io/badge/release-v2.72.0-blue)
27
- [![codecov](https://codecov.io/gh/owasp-sbot/OSBot-Utils/graph/badge.svg?token=GNVW0COX1N)](https://codecov.io/gh/owasp-sbot/OSBot-Utils)
28
-
29
-
30
-
31
- ## Install - Release 1.x
32
-
33
- **for main branch**: just get it from pypi
34
-
35
- ```
36
- pip install osbot-utils
37
- ```
38
-
39
- **for dev branch**: add to requirements.txt
40
-
41
- ```
42
- git+https://github.com/owasp-sbot/OSBot-Utils.git@dev
43
- ```
44
-