Oblate

Latest version: v1.2.1

Safety actively analyzes 685525 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

1.2.0

The version 1.2.0 is live on PyPi!

It has been two months since the last release because I had a lot to do and couldn't find time for Oblate but hopefully over the course of next few weeks, this library will see more release with more important features.

This release comes with a small change set. Some important features such as read only schemas and fields, data preprocessing and most notably, separated support for validating standard Python types (previously, it was only possible through the TypeExpr field). Apart from that, this release also fixes a critical bug that caused SyntaxError on Python versions below 3.11. Some other minor improvements have been implemented.

See the full changelog here: https://oblate.readthedocs.io/en/main/changelog.html#v1-2-0

Stay tuned for more in near future!

1.1.0

Overview
This release mainly focuses on the introduction of type validation features. Oblate now provides type validation of basic type expressions from the Python's `typing` module. These type expressions are implemented into various data structures and other fields that have been added alongside validating raw value using a given type expression.

The new feature set for this release is relatively larger compared to general improvements and bug fixes. The next minor release will focus on these aspects.

New features

- Add `fields.List` for accepting `list` structure.
- Add `fields.Set` for accepting `set` structures.
- Add `fields.Dict` and `fields.TypedDict` for handling dictionaries.
- Add `fields.TypeExpr` for validating types using simple type expressions.
- Add `fields.Any` field as a no validation field.
- Add `fields.Literal` field to accept pre-defined literal values.
- Add `fields.Union` for basic union type validation.
- Add `validate.Range` validator for validating integer ranges.
- Add `validate.Length` validator for validating length of sized types.
- Add `validate.Regex` validator for validating values using regular expression.
- Add `validate.Exclude` validator for disallowing/excluding specific values.
- Add `validate.Or` validator for OR'ing the result of multiple validators.
- Add `Schema.__schema_post_init__` method as a post initialization hook.
- Add `ErrorContext.metadata` for storing extra error information.
- Add `GlobalConfig.warn_unsupported_types` to control behaviour on using unsupported types.
- Add `Field.name` and `Field.schema` properties.
- Add ``init_kwargs`` parameter in `fields.Object` to support passing initialization arguments.

Improvements

- :`fields.Object` field now supports passing `Schema` instances directly instead of raw data.
- `fields.Field.format_error` no longer requires super call and default error messages are resolved automatically.

1.0.0

The first stable release of Oblate.

This brings a complete rewrite of the library. This version is incompatible with previous ones. For an overview of changes, please see 3 pull request.

0.2.0

New features

- Add support for partial schemas
- Add `fields.Partial` field.
- Add `Schema.is_partial` helper method.
- Add `ValidationError.is_field_error` helper to check whether exception relates to a field.
- Add `Schema.after_init_hook` method that gets called when schema is finished initializing.
- Add `load_key` and `dump_key` parameters to `fields.Field` to control the field names during serialization/deserialization of data.
- Add `ValidationError.state` to allow storing state to an error that can later be accessed.
- Add `include` and `exclude` parameters to `Schema.dump`.
- Add `raw` parameter to `Field.validate` and `Field.add_validator` to validate raw value.

Improvements

- `~fields.Object` fields now support raw data serialization upon setting after initialization.
- `Schema` and all fields now have `__slots__` defined for performance sake.
- User defined validators are now ran after field ``value_*`` methods by default. Such that, validators now take serialized value instead of raw one. For previous behaviour, ``raw`` parameter must be used.

Bug fixes

- Fix `Schema.dump` returning empty dictionary.
- Fix fields returning improper values when initializing multiple schemas.
- Fix unable to set ``None`` on nullable fields after initialization.
- Fix field getting the new value using the setter even when the validations fail.


**Full Changelog**: https://github.com/izxxr/oblate/compare/0.1.0...0.2.0

0.1.0

- Initial release

Links

Releases

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.