Changes¶
All notable changes to this project will be documented in this file.
Unreleased¶
0.4 - 2026-04-09¶
Added¶
- Add mypy support with
py.typedand fixed any type hint issues. Note,python==3.8still has type hint issues due to low mypy version available. (50)
0.3 - 2025-10-26¶
Fixed¶
- Fixed issue where non-multiplicative units (e.g. degrees Celsius or degrees Fahrenheits) were not being validated correctly. (44)
- Fixed issue where dimensions without a default unit cannot be validated. (47)
0.2 - 2025-03-30¶
Added¶
- Added
"number"serialization mode to allow users to drop units when serializing a field. (1) - Allow dimensions restriction on fields using
PydanticPintQuantity. Default changed to automatically deduce restrictions instead of only allowing units. Usingrestriction="units"forces the restriction to be on units. (4) - Added
exactoption toPydanticPintQuantity. Enabling this flags forces users to match the exact units of the field. (11) - Added wrapper class for
pint.Quantityinstance to allow value restrictions withpydantic.Field. Restrictions withpydantic.FieldandPydanticPintValuemust be specified as an annotation. (16) - Added unit tests for all advertised features. (34)
Changed¶
- Changed schema to allow units to be optional when validating a dictionary. The check for requiring units happens later in validation by using
strict. (29)
Fixed¶
- Fixed issue where
PydanticPintQuantityfields cannot be used with each other due to different unit registries. (7) - Fixed issue where
PydanticPintValuedid not use global registry. (18) - Refactored validation check on quantity making it simpler to follow. The issue regarding strict mode not properly failing validation is fixed as well. (27)
- Fixed validation of dimensions when using custom contexts. Now, custom contexts that are enabled in the unit registry will be utilized during the check. To use the old behavior, enable exact mode which forces the users to provide units of the exact dimensions. (28)
0.1 - 2024-05-06¶
Added¶
- Added initial code, docs, and tools.