Changelog¶
1.0.0b1¶
Warning
Several important breaking changes were introduced in this version.
Main modules cannot be imported directly from top-level
restiomodule anymore. You will now need to import from the submodules directly (e.g. what used to befrom restio import BaseModelshould now befrom restio.model import BaseModel, and so on).Added support for descriptors using the base type
Field(restio.fields.Field). The following types of Fields are natively available (please visit Fields for all details):- IntField
- StrField
- BoolField
- TupleField
- FrozenSetField
- ModelField
- TupleModelField
- FrozenSetModelField
Behavior of
BaseModelhas been refactored to supportField. The side effect is that dataclasses are no longer supported, and classes should use the descriptor protocol to define fields that must be tracked by restio. As part of that:PrimaryKeyandValueKeyhave been removed, in favor ofField(pk=True).mdataclasshas been removed.BaseModel.pre_setup_modelandBaseModel.post_setup_modelhave been removed.- Model dependencies are now tracked via fields with
depends_on=True. BaseModel.get_keys()method has been replaced for the propertyBaseModel.primary_keys, which now returns a dictionary.- A new model state
UNBOUNDhas been introduced. All new instances of a model will by default have this state until it is added to a transaction.
BaseDAOnow contains an internal attributetransactionof typeTransaction. This field will always contain the instance of the transaction to which the DAO instance is bound.Transaction.getnow requires keyword-only arguments to be provided when passing primary keys. Calls with missing primary keys will fail immediately.Transaction.getwill no longer returnNonewhen no models are found by the DAO or in the cache. Instead, aRuntimeErrorwill be raised.Transaction.getandTransaction.querywill no longer automatically register model dependencies (children). This is done to encourage the use of theTransactionfrom within the DAOs or queries when retrieving multiple models at the same time.In queries, the use of the
selfkeyword (that received the injectedTransactioninstance) has been replaced by an optional keyword-only argumenttransaction.Transaction.querywill now always returntupleas a result, regardless of the return type of the query.@query-annotated functions should now return any Iterable type. The order of the results is preserved in thetuplereturned byTransaction.query.Type-hinting should now work better than before.
The old concept of mutability (indicating if a field can change or not within the premises of restio) has been droped from the framework. From now on, when we refer to
mutableattributes/fields we literally mean the general concept of mutability.Documentation have been completely refactored to include latest changes and more practical examples. The old examples have been removed.
A number of bugs have been fixed.
0.3.0 & older¶
<not available>