validibot-shared 0.4.0__tar.gz → 0.4.3__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.
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/PKG-INFO +41 -27
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/README.md +37 -23
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/pyproject.toml +3 -3
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/validations/envelopes.py +23 -19
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/.gitignore +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/LICENSE +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/NOTICE +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/__init__.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_energyplus_envelopes.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_energyplus_models.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_fmu_envelopes.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_fmu_models.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_package_init.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/tests/test_validations_envelopes.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/__init__.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/energyplus/__init__.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/energyplus/envelopes.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/energyplus/models.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/fmu/__init__.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/fmu/envelopes.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/fmu/models.py +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/py.typed +0 -0
- {validibot_shared-0.4.0 → validibot_shared-0.4.3}/validibot_shared/validations/__init__.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: validibot-shared
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.3
|
|
4
4
|
Summary: Shared library for data interchange between Validibot and validator containers
|
|
5
5
|
Project-URL: Homepage, https://validibot.com
|
|
6
6
|
Project-URL: Documentation, https://docs.validibot.com
|
|
@@ -24,10 +24,10 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
24
24
|
Classifier: Topic :: Scientific/Engineering
|
|
25
25
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
26
26
|
Requires-Python: >=3.10
|
|
27
|
-
Requires-Dist: pydantic
|
|
27
|
+
Requires-Dist: pydantic==2.13.1
|
|
28
28
|
Provides-Extra: dev
|
|
29
|
-
Requires-Dist: pytest
|
|
30
|
-
Requires-Dist: ruff
|
|
29
|
+
Requires-Dist: pytest==9.0.2; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff==0.14.8; extra == 'dev'
|
|
31
31
|
Description-Content-Type: text/markdown
|
|
32
32
|
|
|
33
33
|
<div align="center">
|
|
@@ -50,7 +50,7 @@ Description-Content-Type: text/markdown
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
52
|
> [!NOTE]
|
|
53
|
-
> This library is part of the [Validibot](https://github.com/danielmcquillen/validibot) open-source data validation platform. It defines the data interchange contract between the core platform and
|
|
53
|
+
> This library is part of the [Validibot](https://github.com/danielmcquillen/validibot) open-source data validation platform. It defines the data interchange contract between the core platform and validator backends.
|
|
54
54
|
|
|
55
55
|
---
|
|
56
56
|
|
|
@@ -60,21 +60,23 @@ Description-Content-Type: text/markdown
|
|
|
60
60
|
|------------|-------------|
|
|
61
61
|
| **[validibot](https://github.com/danielmcquillen/validibot)** | Core platform — web UI, REST API, workflow engine |
|
|
62
62
|
| **[validibot-cli](https://github.com/danielmcquillen/validibot-cli)** | Command-line interface |
|
|
63
|
-
| **[validibot-
|
|
63
|
+
| **[validibot-validator-backends](https://github.com/danielmcquillen/validibot-validator-backends)** | Validator backends for advanced validators (EnergyPlus™, FMU) |
|
|
64
64
|
| **[validibot-shared](https://github.com/danielmcquillen/validibot-shared)** (this repo) | Shared Pydantic models for data interchange |
|
|
65
65
|
|
|
66
66
|
---
|
|
67
67
|
|
|
68
68
|
## What is Validibot Shared?
|
|
69
69
|
|
|
70
|
-
Validibot Shared provides the Pydantic models that define how the Validibot core platform communicates with
|
|
70
|
+
Validibot Shared provides the Pydantic models that define how the Validibot core platform communicates with validator backends. When Validibot needs to run a complex validation (like an EnergyPlus™ simulation or FMU probe), it:
|
|
71
71
|
|
|
72
72
|
1. **Creates an input envelope** containing the files to validate and configuration
|
|
73
|
-
2. **Launches a validator
|
|
73
|
+
2. **Launches a validator backend** with the envelope as input
|
|
74
74
|
3. **Receives an output envelope** with validation results, metrics, and artifacts
|
|
75
75
|
|
|
76
76
|
This library ensures both sides speak the same language with full type safety and runtime validation.
|
|
77
77
|
|
|
78
|
+
Terminology note: in the core `validibot` codebase, `AdvancedValidator` is the Django-side validator class that prepares and launches external work. A validator backend, or future `ValidatorBackend` protocol, is the external implementation it delegates to, usually a container or cloud job. This package defines the envelope boundary between that trusted Django-side validator and the external validator backend. The backend does not receive the full Django submission, workflow, permissions, billing, or credential state unless the parent validator intentionally includes specific data in the envelope.
|
|
79
|
+
|
|
78
80
|
## Features
|
|
79
81
|
|
|
80
82
|
- **Type-safe envelopes** — Pydantic models with full IDE autocomplete and type checking
|
|
@@ -85,7 +87,7 @@ This library ensures both sides speak the same language with full type safety an
|
|
|
85
87
|
## Disclaimer
|
|
86
88
|
|
|
87
89
|
> [!NOTE]
|
|
88
|
-
> This library defines data interchange models only — it does not process, store, or transmit user data. However, the models are used by validator
|
|
90
|
+
> This library defines data interchange models only — it does not process, store, or transmit user data. However, the models are used by validator backends that execute user-supplied files. See the [LICENSE](LICENSE) for full warranty disclaimer. The authors accept no liability for the behaviour of systems built using these models.
|
|
89
91
|
|
|
90
92
|
## Installation
|
|
91
93
|
|
|
@@ -212,18 +214,32 @@ validibot_shared/
|
|
|
212
214
|
```python
|
|
213
215
|
from validibot_shared.energyplus import EnergyPlusInputEnvelope, EnergyPlusInputs
|
|
214
216
|
from validibot_shared.validations.envelopes import (
|
|
217
|
+
ExecutionContext,
|
|
215
218
|
InputFileItem,
|
|
219
|
+
OrganizationInfo,
|
|
220
|
+
SupportedMimeType,
|
|
216
221
|
ValidatorInfo,
|
|
217
|
-
|
|
222
|
+
ValidatorType,
|
|
223
|
+
WorkflowInfo,
|
|
218
224
|
)
|
|
219
225
|
|
|
220
226
|
envelope = EnergyPlusInputEnvelope(
|
|
221
227
|
run_id="run-123",
|
|
222
|
-
validator=ValidatorInfo(
|
|
228
|
+
validator=ValidatorInfo(
|
|
229
|
+
id="v1",
|
|
230
|
+
type=ValidatorType.ENERGYPLUS,
|
|
231
|
+
version="24.2.0",
|
|
232
|
+
),
|
|
233
|
+
org=OrganizationInfo(id="org-123", name="Example Org"),
|
|
234
|
+
workflow=WorkflowInfo(
|
|
235
|
+
id="workflow-456",
|
|
236
|
+
step_id="step-789",
|
|
237
|
+
step_name="EnergyPlus Simulation",
|
|
238
|
+
),
|
|
223
239
|
input_files=[
|
|
224
240
|
InputFileItem(
|
|
225
241
|
name="model.idf",
|
|
226
|
-
mime_type=
|
|
242
|
+
mime_type=SupportedMimeType.ENERGYPLUS_IDF,
|
|
227
243
|
role="primary-model",
|
|
228
244
|
uri="gs://bucket/model.idf",
|
|
229
245
|
),
|
|
@@ -235,7 +251,7 @@ envelope = EnergyPlusInputEnvelope(
|
|
|
235
251
|
),
|
|
236
252
|
)
|
|
237
253
|
|
|
238
|
-
# Serialize to JSON for the validator
|
|
254
|
+
# Serialize to JSON for the validator backend
|
|
239
255
|
json_payload = envelope.model_dump_json()
|
|
240
256
|
```
|
|
241
257
|
|
|
@@ -243,15 +259,16 @@ json_payload = envelope.model_dump_json()
|
|
|
243
259
|
|
|
244
260
|
```python
|
|
245
261
|
from validibot_shared.energyplus import EnergyPlusOutputEnvelope
|
|
262
|
+
from validibot_shared.validations.envelopes import ValidationStatus
|
|
246
263
|
|
|
247
264
|
# Parse JSON response from validator
|
|
248
265
|
envelope = EnergyPlusOutputEnvelope.model_validate_json(response_json)
|
|
249
266
|
|
|
250
267
|
# Check status
|
|
251
|
-
if envelope.status ==
|
|
268
|
+
if envelope.status == ValidationStatus.SUCCESS:
|
|
252
269
|
# Access typed outputs with full autocomplete
|
|
253
270
|
if envelope.outputs and envelope.outputs.metrics:
|
|
254
|
-
print(f"EUI: {envelope.outputs.metrics.
|
|
271
|
+
print(f"EUI: {envelope.outputs.metrics.site_eui_kwh_m2} kWh/m²")
|
|
255
272
|
|
|
256
273
|
# Iterate over validation messages
|
|
257
274
|
for message in envelope.messages:
|
|
@@ -354,7 +371,7 @@ This library is one component of the Validibot open-source data validation platf
|
|
|
354
371
|
|------------|-------------|
|
|
355
372
|
| **[validibot](https://github.com/danielmcquillen/validibot)** | Core platform — web UI, REST API, workflow engine |
|
|
356
373
|
| **[validibot-cli](https://github.com/danielmcquillen/validibot-cli)** | Command-line interface |
|
|
357
|
-
| **[validibot-
|
|
374
|
+
| **[validibot-validator-backends](https://github.com/danielmcquillen/validibot-validator-backends)** | Validator backends for advanced validators (EnergyPlus™, FMU) |
|
|
358
375
|
| **[validibot-shared](https://github.com/danielmcquillen/validibot-shared)** (this repo) | Shared Pydantic models for data interchange |
|
|
359
376
|
|
|
360
377
|
### How It Fits Together
|
|
@@ -377,13 +394,13 @@ This library is one component of the Validibot open-source data validation platf
|
|
|
377
394
|
│
|
|
378
395
|
┌──────────────────────────┼──────────────────────────┐
|
|
379
396
|
▼ ▼ ▼
|
|
380
|
-
┌─────────────────┐
|
|
381
|
-
│ validibot-cli │ │ validibot-
|
|
382
|
-
│ │ │
|
|
383
|
-
│ Terminal access │ │ EnergyPlus™, FMU
|
|
384
|
-
│ to API │ │ containers
|
|
385
|
-
│ │ │
|
|
386
|
-
└─────────────────┘
|
|
397
|
+
┌─────────────────┐ ┌──────────────────────────────┐ ┌─────────────────────┐
|
|
398
|
+
│ validibot-cli │ │ validibot-validator-backends │ │ validibot-shared │
|
|
399
|
+
│ │ │ │ │ (this repo) │
|
|
400
|
+
│ Terminal access │ │ EnergyPlus™, FMU │ │ │
|
|
401
|
+
│ to API │ │ containers │ │ Pydantic models │
|
|
402
|
+
│ │ │ │ │ │ (shared contract) │
|
|
403
|
+
└─────────────────┘ └──────────────┼───────────────┘ └─────────────────────┘
|
|
387
404
|
│ ▲
|
|
388
405
|
└──────────────────────────┘
|
|
389
406
|
validators import shared
|
|
@@ -401,13 +418,10 @@ cd validibot-shared
|
|
|
401
418
|
uv sync --extra dev
|
|
402
419
|
|
|
403
420
|
# Run tests
|
|
404
|
-
uv run pytest
|
|
421
|
+
uv run python -m pytest
|
|
405
422
|
|
|
406
423
|
# Run linter
|
|
407
424
|
uv run ruff check .
|
|
408
|
-
|
|
409
|
-
# Run type checker
|
|
410
|
-
uv run mypy src/
|
|
411
425
|
```
|
|
412
426
|
|
|
413
427
|
## Trademarks
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
---
|
|
19
19
|
|
|
20
20
|
> [!NOTE]
|
|
21
|
-
> This library is part of the [Validibot](https://github.com/danielmcquillen/validibot) open-source data validation platform. It defines the data interchange contract between the core platform and
|
|
21
|
+
> This library is part of the [Validibot](https://github.com/danielmcquillen/validibot) open-source data validation platform. It defines the data interchange contract between the core platform and validator backends.
|
|
22
22
|
|
|
23
23
|
---
|
|
24
24
|
|
|
@@ -28,21 +28,23 @@
|
|
|
28
28
|
|------------|-------------|
|
|
29
29
|
| **[validibot](https://github.com/danielmcquillen/validibot)** | Core platform — web UI, REST API, workflow engine |
|
|
30
30
|
| **[validibot-cli](https://github.com/danielmcquillen/validibot-cli)** | Command-line interface |
|
|
31
|
-
| **[validibot-
|
|
31
|
+
| **[validibot-validator-backends](https://github.com/danielmcquillen/validibot-validator-backends)** | Validator backends for advanced validators (EnergyPlus™, FMU) |
|
|
32
32
|
| **[validibot-shared](https://github.com/danielmcquillen/validibot-shared)** (this repo) | Shared Pydantic models for data interchange |
|
|
33
33
|
|
|
34
34
|
---
|
|
35
35
|
|
|
36
36
|
## What is Validibot Shared?
|
|
37
37
|
|
|
38
|
-
Validibot Shared provides the Pydantic models that define how the Validibot core platform communicates with
|
|
38
|
+
Validibot Shared provides the Pydantic models that define how the Validibot core platform communicates with validator backends. When Validibot needs to run a complex validation (like an EnergyPlus™ simulation or FMU probe), it:
|
|
39
39
|
|
|
40
40
|
1. **Creates an input envelope** containing the files to validate and configuration
|
|
41
|
-
2. **Launches a validator
|
|
41
|
+
2. **Launches a validator backend** with the envelope as input
|
|
42
42
|
3. **Receives an output envelope** with validation results, metrics, and artifacts
|
|
43
43
|
|
|
44
44
|
This library ensures both sides speak the same language with full type safety and runtime validation.
|
|
45
45
|
|
|
46
|
+
Terminology note: in the core `validibot` codebase, `AdvancedValidator` is the Django-side validator class that prepares and launches external work. A validator backend, or future `ValidatorBackend` protocol, is the external implementation it delegates to, usually a container or cloud job. This package defines the envelope boundary between that trusted Django-side validator and the external validator backend. The backend does not receive the full Django submission, workflow, permissions, billing, or credential state unless the parent validator intentionally includes specific data in the envelope.
|
|
47
|
+
|
|
46
48
|
## Features
|
|
47
49
|
|
|
48
50
|
- **Type-safe envelopes** — Pydantic models with full IDE autocomplete and type checking
|
|
@@ -53,7 +55,7 @@ This library ensures both sides speak the same language with full type safety an
|
|
|
53
55
|
## Disclaimer
|
|
54
56
|
|
|
55
57
|
> [!NOTE]
|
|
56
|
-
> This library defines data interchange models only — it does not process, store, or transmit user data. However, the models are used by validator
|
|
58
|
+
> This library defines data interchange models only — it does not process, store, or transmit user data. However, the models are used by validator backends that execute user-supplied files. See the [LICENSE](LICENSE) for full warranty disclaimer. The authors accept no liability for the behaviour of systems built using these models.
|
|
57
59
|
|
|
58
60
|
## Installation
|
|
59
61
|
|
|
@@ -180,18 +182,32 @@ validibot_shared/
|
|
|
180
182
|
```python
|
|
181
183
|
from validibot_shared.energyplus import EnergyPlusInputEnvelope, EnergyPlusInputs
|
|
182
184
|
from validibot_shared.validations.envelopes import (
|
|
185
|
+
ExecutionContext,
|
|
183
186
|
InputFileItem,
|
|
187
|
+
OrganizationInfo,
|
|
188
|
+
SupportedMimeType,
|
|
184
189
|
ValidatorInfo,
|
|
185
|
-
|
|
190
|
+
ValidatorType,
|
|
191
|
+
WorkflowInfo,
|
|
186
192
|
)
|
|
187
193
|
|
|
188
194
|
envelope = EnergyPlusInputEnvelope(
|
|
189
195
|
run_id="run-123",
|
|
190
|
-
validator=ValidatorInfo(
|
|
196
|
+
validator=ValidatorInfo(
|
|
197
|
+
id="v1",
|
|
198
|
+
type=ValidatorType.ENERGYPLUS,
|
|
199
|
+
version="24.2.0",
|
|
200
|
+
),
|
|
201
|
+
org=OrganizationInfo(id="org-123", name="Example Org"),
|
|
202
|
+
workflow=WorkflowInfo(
|
|
203
|
+
id="workflow-456",
|
|
204
|
+
step_id="step-789",
|
|
205
|
+
step_name="EnergyPlus Simulation",
|
|
206
|
+
),
|
|
191
207
|
input_files=[
|
|
192
208
|
InputFileItem(
|
|
193
209
|
name="model.idf",
|
|
194
|
-
mime_type=
|
|
210
|
+
mime_type=SupportedMimeType.ENERGYPLUS_IDF,
|
|
195
211
|
role="primary-model",
|
|
196
212
|
uri="gs://bucket/model.idf",
|
|
197
213
|
),
|
|
@@ -203,7 +219,7 @@ envelope = EnergyPlusInputEnvelope(
|
|
|
203
219
|
),
|
|
204
220
|
)
|
|
205
221
|
|
|
206
|
-
# Serialize to JSON for the validator
|
|
222
|
+
# Serialize to JSON for the validator backend
|
|
207
223
|
json_payload = envelope.model_dump_json()
|
|
208
224
|
```
|
|
209
225
|
|
|
@@ -211,15 +227,16 @@ json_payload = envelope.model_dump_json()
|
|
|
211
227
|
|
|
212
228
|
```python
|
|
213
229
|
from validibot_shared.energyplus import EnergyPlusOutputEnvelope
|
|
230
|
+
from validibot_shared.validations.envelopes import ValidationStatus
|
|
214
231
|
|
|
215
232
|
# Parse JSON response from validator
|
|
216
233
|
envelope = EnergyPlusOutputEnvelope.model_validate_json(response_json)
|
|
217
234
|
|
|
218
235
|
# Check status
|
|
219
|
-
if envelope.status ==
|
|
236
|
+
if envelope.status == ValidationStatus.SUCCESS:
|
|
220
237
|
# Access typed outputs with full autocomplete
|
|
221
238
|
if envelope.outputs and envelope.outputs.metrics:
|
|
222
|
-
print(f"EUI: {envelope.outputs.metrics.
|
|
239
|
+
print(f"EUI: {envelope.outputs.metrics.site_eui_kwh_m2} kWh/m²")
|
|
223
240
|
|
|
224
241
|
# Iterate over validation messages
|
|
225
242
|
for message in envelope.messages:
|
|
@@ -322,7 +339,7 @@ This library is one component of the Validibot open-source data validation platf
|
|
|
322
339
|
|------------|-------------|
|
|
323
340
|
| **[validibot](https://github.com/danielmcquillen/validibot)** | Core platform — web UI, REST API, workflow engine |
|
|
324
341
|
| **[validibot-cli](https://github.com/danielmcquillen/validibot-cli)** | Command-line interface |
|
|
325
|
-
| **[validibot-
|
|
342
|
+
| **[validibot-validator-backends](https://github.com/danielmcquillen/validibot-validator-backends)** | Validator backends for advanced validators (EnergyPlus™, FMU) |
|
|
326
343
|
| **[validibot-shared](https://github.com/danielmcquillen/validibot-shared)** (this repo) | Shared Pydantic models for data interchange |
|
|
327
344
|
|
|
328
345
|
### How It Fits Together
|
|
@@ -345,13 +362,13 @@ This library is one component of the Validibot open-source data validation platf
|
|
|
345
362
|
│
|
|
346
363
|
┌──────────────────────────┼──────────────────────────┐
|
|
347
364
|
▼ ▼ ▼
|
|
348
|
-
┌─────────────────┐
|
|
349
|
-
│ validibot-cli │ │ validibot-
|
|
350
|
-
│ │ │
|
|
351
|
-
│ Terminal access │ │ EnergyPlus™, FMU
|
|
352
|
-
│ to API │ │ containers
|
|
353
|
-
│ │ │
|
|
354
|
-
└─────────────────┘
|
|
365
|
+
┌─────────────────┐ ┌──────────────────────────────┐ ┌─────────────────────┐
|
|
366
|
+
│ validibot-cli │ │ validibot-validator-backends │ │ validibot-shared │
|
|
367
|
+
│ │ │ │ │ (this repo) │
|
|
368
|
+
│ Terminal access │ │ EnergyPlus™, FMU │ │ │
|
|
369
|
+
│ to API │ │ containers │ │ Pydantic models │
|
|
370
|
+
│ │ │ │ │ │ (shared contract) │
|
|
371
|
+
└─────────────────┘ └──────────────┼───────────────┘ └─────────────────────┘
|
|
355
372
|
│ ▲
|
|
356
373
|
└──────────────────────────┘
|
|
357
374
|
validators import shared
|
|
@@ -369,13 +386,10 @@ cd validibot-shared
|
|
|
369
386
|
uv sync --extra dev
|
|
370
387
|
|
|
371
388
|
# Run tests
|
|
372
|
-
uv run pytest
|
|
389
|
+
uv run python -m pytest
|
|
373
390
|
|
|
374
391
|
# Run linter
|
|
375
392
|
uv run ruff check .
|
|
376
|
-
|
|
377
|
-
# Run type checker
|
|
378
|
-
uv run mypy src/
|
|
379
393
|
```
|
|
380
394
|
|
|
381
395
|
## Trademarks
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "validibot-shared"
|
|
7
|
-
version = "0.4.
|
|
7
|
+
version = "0.4.3"
|
|
8
8
|
description = "Shared library for data interchange between Validibot and validator containers"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -32,10 +32,10 @@ classifiers = [
|
|
|
32
32
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
33
33
|
"Topic :: Scientific/Engineering",
|
|
34
34
|
]
|
|
35
|
-
dependencies = ["pydantic
|
|
35
|
+
dependencies = ["pydantic==2.13.1"]
|
|
36
36
|
|
|
37
37
|
[project.optional-dependencies]
|
|
38
|
-
dev = ["pytest
|
|
38
|
+
dev = ["pytest==9.0.2", "ruff==0.14.8"]
|
|
39
39
|
|
|
40
40
|
[project.urls]
|
|
41
41
|
Homepage = "https://validibot.com"
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"""
|
|
2
|
-
Pydantic schemas for
|
|
2
|
+
Pydantic schemas for validator backend execution envelopes.
|
|
3
3
|
|
|
4
|
-
These schemas define the contract between Django
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
4
|
+
These schemas define the contract between Django-side advanced validators and
|
|
5
|
+
external validator backends. In the core ``validibot`` codebase,
|
|
6
|
+
``AdvancedValidator`` is the trusted Django-side class that prepares the run,
|
|
7
|
+
builds the envelope, launches external work through an execution backend, and
|
|
8
|
+
processes the output. A validator backend, or future ``ValidatorBackend``
|
|
9
|
+
protocol, is the external implementation it delegates to, usually a container
|
|
10
|
+
or cloud job. The backend receives only this envelope boundary, not the full
|
|
11
|
+
Django submission, workflow, permissions, or billing state.
|
|
8
12
|
|
|
9
|
-
This library is used by both the Django app and
|
|
10
|
-
type safety and contract consistency across the
|
|
13
|
+
This library is used by both the Django app and validator backends
|
|
14
|
+
to ensure type safety and contract consistency across the execution boundary.
|
|
11
15
|
|
|
12
16
|
## Deployment Modes
|
|
13
17
|
|
|
@@ -22,11 +26,11 @@ actual storage handling is done by the validators' storage_client module.
|
|
|
22
26
|
## Architecture Overview
|
|
23
27
|
|
|
24
28
|
This module provides a type-safe interface for communication between the Django
|
|
25
|
-
app and
|
|
29
|
+
app and validator backends:
|
|
26
30
|
|
|
27
31
|
**GCP Mode (async with callbacks):**
|
|
28
32
|
1. Django creates input.json with files, config, callback URL
|
|
29
|
-
2. Django uploads to GCS and triggers validator
|
|
33
|
+
2. Django uploads to GCS and triggers validator backend runtime
|
|
30
34
|
3. Validator downloads inputs, runs validation, uploads outputs
|
|
31
35
|
4. Validator POSTs minimal callback to Django when complete
|
|
32
36
|
5. Django receives callback and loads full output.json from GCS
|
|
@@ -93,7 +97,7 @@ Django deserializes using the correct subclass based on validator.type.
|
|
|
93
97
|
|
|
94
98
|
## Why ValidationCallback?
|
|
95
99
|
|
|
96
|
-
The callback is a minimal async notification sent from the validator
|
|
100
|
+
The callback is a minimal async notification sent from the validator backend
|
|
97
101
|
back to the Django app when work completes. It contains only:
|
|
98
102
|
- run_id: Which job finished
|
|
99
103
|
- status: success/failed_validation/failed_runtime/cancelled
|
|
@@ -130,7 +134,7 @@ class Severity(str, Enum):
|
|
|
130
134
|
|
|
131
135
|
class ValidatorType(str, Enum):
|
|
132
136
|
"""
|
|
133
|
-
Canonical validator types used across Django and validator
|
|
137
|
+
Canonical validator types used across Django and validator backends.
|
|
134
138
|
|
|
135
139
|
These values align with Django's ValidationType TextChoices and should be
|
|
136
140
|
used anywhere we serialize validator identifiers in envelopes.
|
|
@@ -227,9 +231,9 @@ class ValidatorInfo(BaseModel):
|
|
|
227
231
|
"""
|
|
228
232
|
Information about the validator being executed.
|
|
229
233
|
|
|
230
|
-
This identifies which validator
|
|
234
|
+
This identifies which validator backend to run and which version.
|
|
231
235
|
The 'type' field determines:
|
|
232
|
-
1. Which validator
|
|
236
|
+
1. Which validator backend to run (e.g., 'validibot-validator-backend-energyplus')
|
|
233
237
|
2. Which envelope subclass Django uses for deserialization
|
|
234
238
|
(EnergyPlusInputEnvelope, FMUInputEnvelope, etc.)
|
|
235
239
|
|
|
@@ -287,7 +291,7 @@ class ExecutionContext(BaseModel):
|
|
|
287
291
|
"""
|
|
288
292
|
Execution context and callback information.
|
|
289
293
|
|
|
290
|
-
This provides the validator
|
|
294
|
+
This provides the validator backend with everything it needs to:
|
|
291
295
|
1. Download input files from storage (execution_bundle_uri)
|
|
292
296
|
2. Upload output files to storage (execution_bundle_uri)
|
|
293
297
|
3. Notify Django when complete (callback_url)
|
|
@@ -331,10 +335,10 @@ class ExecutionContext(BaseModel):
|
|
|
331
335
|
|
|
332
336
|
class ValidationInputEnvelope(BaseModel):
|
|
333
337
|
"""
|
|
334
|
-
Base input envelope for validator jobs (validibot.input.v1).
|
|
338
|
+
Base input envelope for validator backend jobs (validibot.input.v1).
|
|
335
339
|
|
|
336
340
|
This is written to storage as input.json by Django before triggering
|
|
337
|
-
the validator
|
|
341
|
+
the validator backend.
|
|
338
342
|
|
|
339
343
|
## How Subclassing Works
|
|
340
344
|
|
|
@@ -524,9 +528,9 @@ class ValidationTiming(BaseModel):
|
|
|
524
528
|
|
|
525
529
|
class ValidationOutputEnvelope(BaseModel):
|
|
526
530
|
"""
|
|
527
|
-
Base output envelope for validator jobs (validibot.output.v1).
|
|
531
|
+
Base output envelope for validator backend jobs (validibot.output.v1).
|
|
528
532
|
|
|
529
|
-
This is written to storage as output.json by the validator
|
|
533
|
+
This is written to storage as output.json by the validator backend
|
|
530
534
|
after completion.
|
|
531
535
|
|
|
532
536
|
## How Subclassing Works
|
|
@@ -622,7 +626,7 @@ class ValidationOutputEnvelope(BaseModel):
|
|
|
622
626
|
|
|
623
627
|
class ValidationCallback(BaseModel):
|
|
624
628
|
"""
|
|
625
|
-
Callback payload POSTed from validator
|
|
629
|
+
Callback payload POSTed from validator backend to Django.
|
|
626
630
|
|
|
627
631
|
Minimal payload to avoid duplication - Django loads the full output.json
|
|
628
632
|
from storage after receiving this callback.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|