Commit 35a64b6
Migrate configuration to Pydantic (#591)
* Migrate configuration to Pydantic with validation and auto-generated documentation
Replaces manual JSON configuration parsing with Pydantic models for type safety,
validation, and automatic documentation generation. Includes migration system for
backward compatibility.
Changes:
- Pydantic models for all configuration sections (battery, solar, EV, pricing, etc.)
- Automatic migration from legacy configuration format
- JSON Schema generation for IDE autocomplete
- Auto-generated SETTINGS.md documentation
- GitHub Actions workflow for documentation validation
- Developer guide for extending configuration
Technical details:
- Zero hardcoded knowledge: all documentation generated from Pydantic JSON schema
- Validation ensures all model fields have descriptions
- Fallback mode preserves existing functionality if validation fails
- Supports secrets management via !secret syntax
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Use Type colums for link instead
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Use proper description for SecretStr fields
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Use same pydantic version in CI
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Fix requirements installation for CI
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Fix CI schema
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Use a better way to check for model validation
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Add additional validations
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* auto migrate to latest defined version
This is a more explicit pattern
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Add extensive documentation and hints
This will add in the self-describing of the code and also in the
upcoming GUI.
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Create better settings.md based on additional fields
We use the newly provided json extensions to generate better
documentation.
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Add better ui hints
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update config models and call sites
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update some more field defaults
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update docs
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* add scheduler migration
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update x- helpers
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update dev docs
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update to get ready for review
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* update db call sites that where missed
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* move backup action only when writing config on save
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* simplify migration logic
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* fix documentation output path
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* only migrate data if config version is not current
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* make loading more explicit
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Fix SecretStr resolving
This not automatically resolves secrets with a plain text fallback.
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Also fix FlexValue resolution
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* clarify secretstr serialisation
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* handle list types in models instead of at call site
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* fix encoding thing
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* fix stategy being a FlexValue
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* more cleanup and removal of dead code
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* fix CI
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* use model defaults
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* move sentinel add to config model
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* Add explicit loader errors
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Move config models to prog
Also revert changed to pred to its 2026.03.0 state
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* add default and make some keys optional
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* made a few adjustments ["name"] to .name and dynamic defaults
* adjusted hp_power from W to kW
* changed obj['name'] to obj.name several places
* made predictor work
* implemented singleton for config and loader
* removed all miplib stuff from run.sh
* add save logic to migrations
Save pre-migration config to options_{version}.json before migrating
Save migrated config back to disk after migration
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* lock config during migration
To prevent any races (unlikely, but possible) we lock the config file
during migration.
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* remove obsolute method
the load_secrets method is not used publicly, so we make that private
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* use pydantic model dump for save
This ensures we save using proper key names, that do not conflict with
json schema / jsonforms
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* rearranged the da-prediction stuff
* don't dump null values
we shouldn't save null values
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* add config file unit tests
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* coearse strings to booleans
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* update CI to not fail when updating docs
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* trigger doc rebuild
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* add concurrency lock to gen docs
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* trigger another doc build
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* another trigger
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Auto-generate documentation from Pydantic models
- Updated SETTINGS.md
- Updated config_schema.json
Generated by GitHub Actions workflow
* change CI to only comment when docs need updating
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* trigger rebuild
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Update generated documentation
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* use more comments to search
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* trigger again
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Update generated documentation
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* use workflow failure message in action
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Revert "use workflow failure message in action"
This reverts commit c1841cb.
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* trigger again
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* Update generated documentation
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* change name of workflow to better indicate its function
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
* delete miplib archives
* Version 2026.03.3.rc1
* update changelog
* update prediction stuff
* update Dockerfile: deleted line with miplib extraction
---------
Signed-off-by: Jeroen Simonetti <jeroen@simonetti.nl>
Co-authored-by: Jeroen Simonetti <jeroen@simonetti.nl>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>1 parent c369b63 commit 35a64b6
File tree
67 files changed
+12531
-904
lines changed- .github/workflows
- dao
- data
- lib
- pred
- data
- prog
- config
- migrations
- models
- devices
- versions
- run
- tests/config
- webserver
- app
- release-testing
- scripts
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
67 files changed
+12531
-904
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
43 | 43 | | |
44 | 44 | | |
45 | 45 | | |
46 | | - | |
47 | | - | |
| 46 | + | |
| 47 | + | |
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
52 | | - | |
53 | | - | |
| 52 | + | |
| 53 | + | |
54 | 54 | | |
55 | 55 | | |
56 | | - | |
| 56 | + | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
0 commit comments