xecurecode-reliability-sdk 0.1.1__tar.gz

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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 XecureTrace
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.
@@ -0,0 +1,247 @@
1
+ Metadata-Version: 2.4
2
+ Name: xecurecode-reliability-sdk
3
+ Version: 0.1.1
4
+ Summary: AI-driven reliability SDK for Python applications
5
+ Author-email: XecureCode Team <team@xecurecode.in>
6
+ License: MIT
7
+ Classifier: Development Status :: 4 - Beta
8
+ Classifier: Intended Audience :: Developers
9
+ Classifier: License :: OSI Approved :: MIT License
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.8
12
+ Classifier: Programming Language :: Python :: 3.9
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Requires-Python: >=3.8
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Provides-Extra: fastapi
20
+ Requires-Dist: fastapi>=0.100; extra == "fastapi"
21
+ Provides-Extra: flask
22
+ Requires-Dist: flask>=2.0; extra == "flask"
23
+ Provides-Extra: django
24
+ Requires-Dist: django>=3.0; extra == "django"
25
+ Dynamic: license-file
26
+
27
+ # XecureCode Reliability SDK - Python
28
+
29
+ AI-driven reliability SDK for Python applications.
30
+
31
+ The official Python SDK for the XecureCode Reliability Platform — a human-first failure analysis and recovery recommendation system.
32
+
33
+ ---
34
+
35
+ ## Why This SDK Exists
36
+
37
+ Modern backend systems fail in unpredictable ways.
38
+
39
+ This SDK:
40
+
41
+ - Captures structured runtime errors
42
+ - Generates deterministic fingerprints
43
+ - Classifies error types (DATABASE, NETWORK, VALIDATION, etc.)
44
+ - Determines severity
45
+ - Sends non-blocking telemetry to your backend
46
+ - Never crashes your application
47
+
48
+ **AI assists. Humans decide. Nothing executes automatically.**
49
+
50
+ ---
51
+
52
+ ## Requirements
53
+
54
+ - Python 3.8+
55
+ - FastAPI, Flask, or Django (optional)
56
+
57
+ ---
58
+
59
+ ## Installation
60
+
61
+ ```bash
62
+ pip install xecurecode-reliability-sdk
63
+ ```
64
+
65
+ Or install with framework support:
66
+
67
+ ```bash
68
+ pip install xecurecode-reliability-sdk[fastapi,flask,django]
69
+ ```
70
+
71
+ ---
72
+
73
+ ## Quick Start
74
+
75
+ ### 1️⃣ Initialize the SDK
76
+
77
+ ```python
78
+ from reliability import ReliabilityClient, ReliabilityConfig
79
+
80
+ config = ReliabilityConfig(
81
+ api_key="your-api-key",
82
+ service_id="your-service",
83
+ mode="development"
84
+ )
85
+ client = ReliabilityClient(config)
86
+ ```
87
+
88
+ **Configuration Options:**
89
+
90
+ | Parameter | Required | Description |
91
+ |-----------|----------|-------------|
92
+ | `api_key` | Yes | Your API key |
93
+ | `service_id` | Yes | Service identifier |
94
+ | `mode` | Yes | `development` or `production` |
95
+ | `timeout` | No | Request timeout (default: 5000ms) |
96
+
97
+ ---
98
+
99
+ ### 2️⃣ Automatic Global Error Capture
100
+
101
+ The SDK automatically handles:
102
+ - Uncaught exceptions
103
+ - Thread exceptions
104
+
105
+ ```python
106
+ # This will be automatically captured
107
+ raise ValueError("Database timeout")
108
+ ```
109
+
110
+ ---
111
+
112
+ ### 3️⃣ FastAPI Integration
113
+
114
+ ```python
115
+ from fastapi import FastAPI
116
+ from reliability import ReliabilityClient, ReliabilityConfig
117
+ from reliability.fastapi_integration import FastAPIMiddleware
118
+
119
+ config = ReliabilityConfig(...)
120
+ client = ReliabilityClient(config)
121
+
122
+ app = FastAPI()
123
+ app.add_middleware(FastAPIMiddleware, client=client)
124
+ ```
125
+
126
+ ---
127
+
128
+ ### 4️⃣ Flask Integration
129
+
130
+ ```python
131
+ from flask import Flask
132
+ from reliability import ReliabilityClient, ReliabilityConfig
133
+ from reliability.flask_integration import init_flask
134
+
135
+ config = ReliabilityConfig(...)
136
+ client = ReliabilityClient(config)
137
+
138
+ app = Flask(__name__)
139
+ init_flask(app, client)
140
+ ```
141
+
142
+ ---
143
+
144
+ ### 5️⃣ Django Integration
145
+
146
+ In `settings.py`:
147
+
148
+ ```python
149
+ RELIABILITY_API_KEY = "your-api-key"
150
+ RELIABILITY_SERVICE_ID = "your-service"
151
+ RELIABILITY_MODE = "development"
152
+ ```
153
+
154
+ In `settings.py` MIDDLEWARE:
155
+
156
+ ```python
157
+ MIDDLEWARE = [
158
+ ...
159
+ 'reliability.django_integration.ReliabilityMiddleware',
160
+ ...
161
+ ]
162
+ ```
163
+
164
+ ---
165
+
166
+ ### 6️⃣ Manual Capture
167
+
168
+ ```python
169
+ try:
170
+ risky_operation()
171
+ except Exception as e:
172
+ client.capture(e)
173
+
174
+ # With request context
175
+ client.capture(e, request)
176
+ ```
177
+
178
+ ---
179
+
180
+ ## What Gets Sent
181
+
182
+ Example structured payload:
183
+
184
+ ```json
185
+ {
186
+ "message": "Database connection failed",
187
+ "name": "ValueError",
188
+ "fingerprint": "a8c39c21...",
189
+ "timestamp": 1700000000000,
190
+ "service": "my-service",
191
+ "environment": "development",
192
+ "severity": "critical",
193
+ "errorType": "DATABASE",
194
+ "serviceContext": {
195
+ "pid": 12345,
196
+ "runtime": "python",
197
+ "runtimeVersion": "3.11.0",
198
+ "pythonVersion": "3.11.0",
199
+ "platform": "Linux-5.10.0",
200
+ "hostname": "server-01"
201
+ },
202
+ "requestContext": {
203
+ "method": "GET",
204
+ "url": "/api/users",
205
+ "ip": "10.0.0.5"
206
+ },
207
+ "occurrenceCount": 1
208
+ }
209
+ ```
210
+
211
+ ---
212
+
213
+ ## Error Classification
214
+
215
+ | Type | Example |
216
+ |------|---------|
217
+ | DATABASE | Timeout, SQL errors, connection issues |
218
+ | NETWORK | HTTP failures, socket errors |
219
+ | VALIDATION | Invalid input, type errors |
220
+ | AUTH | Permission denied |
221
+ | RUNTIME | Standard Python errors |
222
+
223
+ ---
224
+
225
+ ## Severity Detection
226
+
227
+ - **Critical** → Database, timeout, connection errors
228
+ - **Medium** → Validation, recoverable issues
229
+
230
+ ---
231
+
232
+ ## Design Guarantees
233
+
234
+ - Non-blocking HTTP calls
235
+ - Timeout protected (5s default)
236
+ - Retry logic (3 attempts)
237
+ - Deduplication (1-minute window)
238
+ - Rate limiting (max 100 concurrent)
239
+ - Never throws inside SDK
240
+ - Never crashes host application
241
+ - Works with FastAPI, Flask, Django
242
+
243
+ ---
244
+
245
+ ## License
246
+
247
+ MIT
@@ -0,0 +1,221 @@
1
+ # XecureCode Reliability SDK - Python
2
+
3
+ AI-driven reliability SDK for Python applications.
4
+
5
+ The official Python SDK for the XecureCode Reliability Platform — a human-first failure analysis and recovery recommendation system.
6
+
7
+ ---
8
+
9
+ ## Why This SDK Exists
10
+
11
+ Modern backend systems fail in unpredictable ways.
12
+
13
+ This SDK:
14
+
15
+ - Captures structured runtime errors
16
+ - Generates deterministic fingerprints
17
+ - Classifies error types (DATABASE, NETWORK, VALIDATION, etc.)
18
+ - Determines severity
19
+ - Sends non-blocking telemetry to your backend
20
+ - Never crashes your application
21
+
22
+ **AI assists. Humans decide. Nothing executes automatically.**
23
+
24
+ ---
25
+
26
+ ## Requirements
27
+
28
+ - Python 3.8+
29
+ - FastAPI, Flask, or Django (optional)
30
+
31
+ ---
32
+
33
+ ## Installation
34
+
35
+ ```bash
36
+ pip install xecurecode-reliability-sdk
37
+ ```
38
+
39
+ Or install with framework support:
40
+
41
+ ```bash
42
+ pip install xecurecode-reliability-sdk[fastapi,flask,django]
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Quick Start
48
+
49
+ ### 1️⃣ Initialize the SDK
50
+
51
+ ```python
52
+ from reliability import ReliabilityClient, ReliabilityConfig
53
+
54
+ config = ReliabilityConfig(
55
+ api_key="your-api-key",
56
+ service_id="your-service",
57
+ mode="development"
58
+ )
59
+ client = ReliabilityClient(config)
60
+ ```
61
+
62
+ **Configuration Options:**
63
+
64
+ | Parameter | Required | Description |
65
+ |-----------|----------|-------------|
66
+ | `api_key` | Yes | Your API key |
67
+ | `service_id` | Yes | Service identifier |
68
+ | `mode` | Yes | `development` or `production` |
69
+ | `timeout` | No | Request timeout (default: 5000ms) |
70
+
71
+ ---
72
+
73
+ ### 2️⃣ Automatic Global Error Capture
74
+
75
+ The SDK automatically handles:
76
+ - Uncaught exceptions
77
+ - Thread exceptions
78
+
79
+ ```python
80
+ # This will be automatically captured
81
+ raise ValueError("Database timeout")
82
+ ```
83
+
84
+ ---
85
+
86
+ ### 3️⃣ FastAPI Integration
87
+
88
+ ```python
89
+ from fastapi import FastAPI
90
+ from reliability import ReliabilityClient, ReliabilityConfig
91
+ from reliability.fastapi_integration import FastAPIMiddleware
92
+
93
+ config = ReliabilityConfig(...)
94
+ client = ReliabilityClient(config)
95
+
96
+ app = FastAPI()
97
+ app.add_middleware(FastAPIMiddleware, client=client)
98
+ ```
99
+
100
+ ---
101
+
102
+ ### 4️⃣ Flask Integration
103
+
104
+ ```python
105
+ from flask import Flask
106
+ from reliability import ReliabilityClient, ReliabilityConfig
107
+ from reliability.flask_integration import init_flask
108
+
109
+ config = ReliabilityConfig(...)
110
+ client = ReliabilityClient(config)
111
+
112
+ app = Flask(__name__)
113
+ init_flask(app, client)
114
+ ```
115
+
116
+ ---
117
+
118
+ ### 5️⃣ Django Integration
119
+
120
+ In `settings.py`:
121
+
122
+ ```python
123
+ RELIABILITY_API_KEY = "your-api-key"
124
+ RELIABILITY_SERVICE_ID = "your-service"
125
+ RELIABILITY_MODE = "development"
126
+ ```
127
+
128
+ In `settings.py` MIDDLEWARE:
129
+
130
+ ```python
131
+ MIDDLEWARE = [
132
+ ...
133
+ 'reliability.django_integration.ReliabilityMiddleware',
134
+ ...
135
+ ]
136
+ ```
137
+
138
+ ---
139
+
140
+ ### 6️⃣ Manual Capture
141
+
142
+ ```python
143
+ try:
144
+ risky_operation()
145
+ except Exception as e:
146
+ client.capture(e)
147
+
148
+ # With request context
149
+ client.capture(e, request)
150
+ ```
151
+
152
+ ---
153
+
154
+ ## What Gets Sent
155
+
156
+ Example structured payload:
157
+
158
+ ```json
159
+ {
160
+ "message": "Database connection failed",
161
+ "name": "ValueError",
162
+ "fingerprint": "a8c39c21...",
163
+ "timestamp": 1700000000000,
164
+ "service": "my-service",
165
+ "environment": "development",
166
+ "severity": "critical",
167
+ "errorType": "DATABASE",
168
+ "serviceContext": {
169
+ "pid": 12345,
170
+ "runtime": "python",
171
+ "runtimeVersion": "3.11.0",
172
+ "pythonVersion": "3.11.0",
173
+ "platform": "Linux-5.10.0",
174
+ "hostname": "server-01"
175
+ },
176
+ "requestContext": {
177
+ "method": "GET",
178
+ "url": "/api/users",
179
+ "ip": "10.0.0.5"
180
+ },
181
+ "occurrenceCount": 1
182
+ }
183
+ ```
184
+
185
+ ---
186
+
187
+ ## Error Classification
188
+
189
+ | Type | Example |
190
+ |------|---------|
191
+ | DATABASE | Timeout, SQL errors, connection issues |
192
+ | NETWORK | HTTP failures, socket errors |
193
+ | VALIDATION | Invalid input, type errors |
194
+ | AUTH | Permission denied |
195
+ | RUNTIME | Standard Python errors |
196
+
197
+ ---
198
+
199
+ ## Severity Detection
200
+
201
+ - **Critical** → Database, timeout, connection errors
202
+ - **Medium** → Validation, recoverable issues
203
+
204
+ ---
205
+
206
+ ## Design Guarantees
207
+
208
+ - Non-blocking HTTP calls
209
+ - Timeout protected (5s default)
210
+ - Retry logic (3 attempts)
211
+ - Deduplication (1-minute window)
212
+ - Rate limiting (max 100 concurrent)
213
+ - Never throws inside SDK
214
+ - Never crashes host application
215
+ - Works with FastAPI, Flask, Django
216
+
217
+ ---
218
+
219
+ ## License
220
+
221
+ MIT
@@ -0,0 +1,34 @@
1
+ [build-system]
2
+ requires = ["setuptools>=45", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "xecurecode-reliability-sdk"
7
+ version = "0.1.1"
8
+ description = "AI-driven reliability SDK for Python applications"
9
+ readme = "README.md"
10
+ license = {text = "MIT"}
11
+ authors = [
12
+ {name = "XecureCode Team", email = "team@xecurecode.in"}
13
+ ]
14
+ requires-python = ">=3.8"
15
+ dependencies = []
16
+ classifiers = [
17
+ "Development Status :: 4 - Beta",
18
+ "Intended Audience :: Developers",
19
+ "License :: OSI Approved :: MIT License",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.8",
22
+ "Programming Language :: Python :: 3.9",
23
+ "Programming Language :: Python :: 3.10",
24
+ "Programming Language :: Python :: 3.11",
25
+ "Programming Language :: Python :: 3.12",
26
+ ]
27
+
28
+ [project.optional-dependencies]
29
+ fastapi = ["fastapi>=0.100"]
30
+ flask = ["flask>=2.0"]
31
+ django = ["django>=3.0"]
32
+
33
+ [tool.setuptools.packages.find]
34
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,17 @@
1
+ """
2
+ XecureCode Reliability SDK for Python
3
+ """
4
+
5
+ from .config import ReliabilityConfig
6
+ from .client import ReliabilityClient, init, get_client
7
+ from .payload import create_error_payload
8
+
9
+ __version__ = "0.1.1"
10
+
11
+ __all__ = [
12
+ "ReliabilityConfig",
13
+ "ReliabilityClient",
14
+ "create_error_payload",
15
+ "init",
16
+ "get_client",
17
+ ]