♻️ Full re-work on internals to use pydantic models
🧹 Internal evolution to update the code style to the latest versions and de facto standards, with better typing, input validation, and serialization.
Hardly any new features (.make_svg()
), but some bug fixes.
BREAKING-CHANGE: Now the chart creation from a configuration key/file/dict is done with
PsychroChart.create(config)
, instead of oldPsychroChart(config)
Changes
-
🏗️ Add
pydantic
models for chart + annotations styling and config, for better (de)serialization and parameter validation.New models are:
CurveStyle
,LabelStyle
,TickStyle
,ZoneStyle
:= to parse & handle defaults for matplotlib styling parametersChartConfig
for the full chart configuration, including sub-modelsChartFigure
,ChartLimits
, andChartParams
, to mirror the old obfuscated config, with the same default values as beforeChartPoint
andChartSeries
for styled single-point or array-data annotationsChartLine
for styled connectors between named points (now without outline 'marker' by default)ChartArea
for styled convex areas delimited by a list of named pointsChartAnnots
as container for all of the aboveChartZone
(andChartZones
as a list), for styled fixed areas (like the default winter/summer comfort zones)
-
♻️ Evolve load methods to parse inputs into pydantic models with near-zero (expected 🤞) breaks when reading old data
-
💥 Rework
PsychroChart
class to work with pydanticPsychroChartModel
. As the chart is now a pydantic model, there is achart.json(...)
method, and loading from serialized data is available withPsychroChart.parse_file(
/.validate(
/ etc 🤩 -
✨ Add
.make_svg()
method to produce a SVG file as text, and evolve.save(...)
with optionalcanvas_cls: Type[FigureCanvasBase]
, to select kind of matplotlib canvas where to print the chart -
✨ Support file creation in subfolders with chart.save(dest)
-
🚚 rsc: Deterministic SVG output in tests, and README images without date metadata
-
✅ tests: Adapt API changes in unit tests, remove usages of
unittest.TestCase
, add new tests for pydantic models, annotations, and serialization methods.