Skip to content

2.0.0

Compare
Choose a tag to compare
@keithasaurus keithasaurus released this 09 Nov 05:55
· 26 commits to main since this release
e3afc45

Asyncio Validation / Faster synchronous validation / More Flexible Dictionary Validation

All built-in validators now fully compatible with asyncio. See the docs for more.

Significantly faster than v1.0 -- and 1.5x - 12x faster than Pydantic in (synchronous) benchmarks

RecordValidator and DictValidatorAny can now handle any kind of dict key, and whether it's required or not.

Features

  • asyncio is supported with .validate_async method
  • PredicateAsync is added
  • RecordValidator (and DictValidatorAny) can now handle any kind of dict key.
  • AlwaysValid is added
  • Predicates and Processors are allowed more extensively across built-in validators.

Performance

  • speed has improved as much as 60x (Koda Validate is now significantly faster than Pydantic)

Breaking Changes

  • Ok / Err / Result (from koda) -> Valid / Invalid / Result (from koda_validate)
  • dict_validator -> RecordValidator
  • DictNKeysValidators are removed. Instead, RecordValidator is used.
  • RecordValidator requires all arguments as keyword-only
  • RecordValidator accepts up-to 16 keys
  • key helper is removed
  • maybe_key helper is replaced by KeyNotRequired
  • MapValidator requires all arguments as keyword-only
  • ListValidator requires Predicates to be specified as a keyword argument
  • the order and number of some __match_args__ has changed
  • most validators are no longer dataclasses; __repr__s may differ
  • validate_and_map is deprecated and removed from koda_validate imports.
  • file structure has changed
    • typedefs.py -> base.py
    • utils.py -> _internals.py

Maintenance

  • bench folder is added for benchmarks
  • python3.11 added to CI
  • pypy3.9 added to CI
  • min coverage bumped to 95%
  • lots of tests added