Migrating to Karni 1.0¶
1.0 removes everything that 0.2 deprecated. Each removal warned for a whole
release with a KarniDeprecationWarning linking its note in
0.2. Code that still uses one of these
names fails at import or on first use in 1.0.
What the removal requires¶
| Removed in 1.0 | Use instead | karni upgrade |
|---|---|---|
Model.all_objects |
Model.objects.without("soft_delete", reason=...) |
rewrites it |
objects.all_with_deleted() |
objects.without("soft_delete", reason=...) |
rewrites it |
objects.deleted_only() |
objects.without("soft_delete", reason=...).dead() |
rewrites it |
karni.managers.SoftDeleteManagerMixin |
karni.managers.ScopedManagerMixin |
rewrites it |
BaseViewSet.object_permission_classes |
the access declaration |
lists each viewset |
karni.api.expansion.related_lookups() |
karni.api.optimizer.optimize(...) |
lists each use |
karni.api.expansion.scoped_related_lookups() |
karni.api.optimizer.optimize(..., scope=...) |
lists each use |
Upgrading¶
You can do all of it on 0.2, before 1.0 ships. Every replacement already exists in 0.2:
karni upgrade --to 1.0 --dry-run # the diff, and the list of manual changes
karni upgrade --to 1.0 # apply (clean git tree, or --allow-dirty)
--to 1.0 selects every change that breaks in 1.0, whichever release
deprecated it. Then make the manual changes from the report and confirm that
nothing deprecated is left:
A clean run means that raising the pin to 1.0 breaks nothing that Karni
deprecated. A project still on 0.1 can go straight there: karni upgrade --to 1.0
also applies the 0.2 changes on the way, in release order.