Commit 63a5ec0
Rework with pydantic + svg images in documentation (#380)
### Quick summary of important changes:
- switched from marshmallow + attr / attrs to [pydantic](https://pydantic-docs.helpmanual.io/)
- [data validation](https://pydantic-docs.helpmanual.io/usage/validators/) and de/serialization will be processed by pydantic
- serialization with `<instance>.json(by_alias=True, ensure_ascii=False)`
- deserialization with `<class>.parse_raw(<json_string>)`
- note: pydantic comes with some [useful types](https://pydantic-docs.helpmanual.io/usage/types/)
- now schema-classes aren't neccessary anymore -> removed
- json-schemas for readthedocs are created via `.schema_json()`
- important note: json-schema files got renamed from `<classname>Schema.json` to `<classname>.json`
- important note: Now e.g. `"2.4"` would be accepted as `Decimal` if the string is parsable (and it will be parsed!) -> a field with e.g. `Decimal` type hint will always be `Decimal`. But it can be set/initialized through e.g. a string if the string is parsable into a `Decimal`. However, the type checker would cry if you try this without "type casting" :)
- auto creation of uml-diagrams and integration with sphinx
- when building the docs local via `tox -e docs` or `tox`, the generated [Plantuml](https://plantuml.com/de/) (Java software)-files will be sent to [kroki.io](https://kroki.io) web service in order to generate the svg images. This means, it will be painfully slow with ICE WLAN :)
- uml-diagrams are generated for all classes in `bo` and `com` on runtime via: `docs/conf.py` -> `docs/uml.py` -> creates `*.puml` files in `docs/api/uml` -> sent to kroki.io and get svg -> save to `_static` folder
- `*.svg` files can be included in docstrings via an object tag, e.g. `<object data="../_static/images/bo4e/bo/Marktlokation.svg" type="image/svg+xml"></object>`
- Note: The links inside the svgs are absolute. If you want svg files with other base URIs (or no base URIs, just relative paths), you just have to change `LINK_BASE_URI` in `docs/uml.py`
Co-authored-by: Leon Haffmans <leon.haffmans@hochfrequenz.de>
Co-authored-by: konstantin <konstantin.klein@hochfrequenz.de>1 parent da0753e commit 63a5ec0
File tree
388 files changed
+42664
-686642
lines changed- docs
- json_schemas
- bo
- com
- src/bo4e
- bo
- com
- tests
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
388 files changed
+42664
-686642
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
162 | 162 | | |
163 | 163 | | |
164 | 164 | | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
20 | | - | |
| 20 | + | |
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | | - | |
| 26 | + | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
32 | 32 | | |
33 | | - | |
| 33 | + | |
34 | 34 | | |
35 | 35 | | |
36 | 36 | | |
| |||
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | | - | |
60 | | - | |
| 59 | + | |
| 60 | + | |
61 | 61 | | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
| 62 | + | |
69 | 63 | | |
70 | 64 | | |
71 | 65 | | |
72 | 66 | | |
73 | 67 | | |
74 | 68 | | |
75 | | - | |
76 | | - | |
| 69 | + | |
77 | 70 | | |
78 | | - | |
79 | | - | |
| 71 | + | |
| 72 | + | |
80 | 73 | | |
81 | | - | |
82 | | - | |
| 74 | + | |
| 75 | + | |
83 | 76 | | |
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
87 | | - | |
88 | 80 | | |
89 | 81 | | |
90 | 82 | | |
91 | | - | |
| 83 | + | |
92 | 84 | | |
93 | 85 | | |
94 | | - | |
| 86 | + | |
| 87 | + | |
95 | 88 | | |
| 89 | + | |
96 | 90 | | |
97 | | - | |
| 91 | + | |
98 | 92 | | |
99 | | - | |
| 93 | + | |
100 | 94 | | |
101 | 95 | | |
102 | 96 | | |
103 | 97 | | |
104 | | - | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
105 | 105 | | |
106 | 106 | | |
107 | 107 | | |
108 | 108 | | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | 109 | | |
131 | | - | |
132 | | - | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
133 | 113 | | |
134 | 114 | | |
135 | 115 | | |
| |||
144 | 124 | | |
145 | 125 | | |
146 | 126 | | |
147 | | - | |
| 127 | + | |
148 | 128 | | |
149 | 129 | | |
150 | 130 | | |
| |||
153 | 133 | | |
154 | 134 | | |
155 | 135 | | |
156 | | - | |
| 136 | + | |
157 | 137 | | |
158 | 138 | | |
159 | | - | |
160 | | - | |
| 139 | + | |
| 140 | + | |
161 | 141 | | |
162 | | - | |
| 142 | + | |
163 | 143 | | |
164 | 144 | | |
165 | | - | |
| 145 | + | |
166 | 146 | | |
167 | 147 | | |
168 | 148 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
| 24 | + | |
| 25 | + | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
| |||
251 | 255 | | |
252 | 256 | | |
253 | 257 | | |
254 | | - | |
| 258 | + | |
255 | 259 | | |
256 | 260 | | |
257 | 261 | | |
| |||
288 | 292 | | |
289 | 293 | | |
290 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
0 commit comments