django-bulk-hooks 0.2.76__tar.gz → 0.2.77__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of django-bulk-hooks might be problematic. Click here for more details.

Files changed (27) hide show
  1. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/PKG-INFO +1 -1
  2. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/dispatcher.py +1 -4
  3. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/manager.py +0 -6
  4. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/coordinator.py +4 -20
  5. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/queryset.py +2 -14
  6. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/pyproject.toml +1 -1
  7. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/LICENSE +0 -0
  8. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/README.md +0 -0
  9. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/__init__.py +0 -0
  10. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/changeset.py +0 -0
  11. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/conditions.py +0 -0
  12. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/constants.py +0 -0
  13. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/context.py +0 -0
  14. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/decorators.py +0 -0
  15. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/enums.py +0 -0
  16. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/factory.py +0 -0
  17. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/handler.py +0 -0
  18. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/helpers.py +0 -0
  19. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/models.py +0 -0
  20. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/__init__.py +0 -0
  21. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/analyzer.py +0 -0
  22. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/bulk_executor.py +0 -0
  23. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/field_utils.py +0 -0
  24. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/mti_handler.py +0 -0
  25. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/mti_plans.py +0 -0
  26. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/operations/record_classifier.py +0 -0
  27. {django_bulk_hooks-0.2.76 → django_bulk_hooks-0.2.77}/django_bulk_hooks/registry.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: django-bulk-hooks
3
- Version: 0.2.76
3
+ Version: 0.2.77
4
4
  Summary: Hook-style hooks for Django bulk operations like bulk_create and bulk_update.
5
5
  License: MIT
6
6
  Keywords: django,bulk,hooks
@@ -37,7 +37,6 @@ class HookDispatcher:
37
37
  operation,
38
38
  event_prefix,
39
39
  bypass_hooks=False,
40
- bypass_validation=False,
41
40
  ):
42
41
  """
43
42
  Execute operation with full hook lifecycle.
@@ -53,7 +52,6 @@ class HookDispatcher:
53
52
  operation: Callable that performs the actual DB operation
54
53
  event_prefix: 'create', 'update', or 'delete'
55
54
  bypass_hooks: Skip all hooks if True
56
- bypass_validation: Skip validation hooks if True
57
55
 
58
56
  Returns:
59
57
  Result of operation
@@ -62,8 +60,7 @@ class HookDispatcher:
62
60
  return operation()
63
61
 
64
62
  # VALIDATE phase
65
- if not bypass_validation:
66
- self.dispatch(changeset, f"validate_{event_prefix}", bypass_hooks=False)
63
+ self.dispatch(changeset, f"validate_{event_prefix}", bypass_hooks=False)
67
64
 
68
65
  # BEFORE phase
69
66
  self.dispatch(changeset, f"before_{event_prefix}", bypass_hooks=False)
@@ -44,7 +44,6 @@ class BulkHookManager(models.Manager):
44
44
  update_fields=None,
45
45
  unique_fields=None,
46
46
  bypass_hooks=False,
47
- bypass_validation=False,
48
47
  **kwargs,
49
48
  ):
50
49
  """
@@ -61,7 +60,6 @@ class BulkHookManager(models.Manager):
61
60
  update_fields=update_fields,
62
61
  unique_fields=unique_fields,
63
62
  bypass_hooks=bypass_hooks,
64
- bypass_validation=bypass_validation,
65
63
  **kwargs,
66
64
  )
67
65
 
@@ -70,7 +68,6 @@ class BulkHookManager(models.Manager):
70
68
  objs,
71
69
  fields=None,
72
70
  bypass_hooks=False,
73
- bypass_validation=False,
74
71
  **kwargs,
75
72
  ):
76
73
  """
@@ -88,7 +85,6 @@ class BulkHookManager(models.Manager):
88
85
  "bulk_update",
89
86
  objs,
90
87
  bypass_hooks=bypass_hooks,
91
- bypass_validation=bypass_validation,
92
88
  **kwargs,
93
89
  )
94
90
 
@@ -97,7 +93,6 @@ class BulkHookManager(models.Manager):
97
93
  objs,
98
94
  batch_size=None,
99
95
  bypass_hooks=False,
100
- bypass_validation=False,
101
96
  **kwargs,
102
97
  ):
103
98
  """
@@ -110,7 +105,6 @@ class BulkHookManager(models.Manager):
110
105
  objs,
111
106
  batch_size=batch_size,
112
107
  bypass_hooks=bypass_hooks,
113
- bypass_validation=bypass_validation,
114
108
  **kwargs,
115
109
  )
116
110
 
@@ -161,7 +161,6 @@ class BulkOperationCoordinator:
161
161
  update_fields=None,
162
162
  unique_fields=None,
163
163
  bypass_hooks=False,
164
- bypass_validation=False,
165
164
  ):
166
165
  """
167
166
  Execute bulk create with hooks.
@@ -174,7 +173,6 @@ class BulkOperationCoordinator:
174
173
  update_fields: Fields to update on conflict
175
174
  unique_fields: Fields to check for conflicts
176
175
  bypass_hooks: Skip all hooks if True
177
- bypass_validation: Skip validation hooks if True
178
176
 
179
177
  Returns:
180
178
  List of created objects
@@ -230,7 +228,6 @@ class BulkOperationCoordinator:
230
228
  operation=operation,
231
229
  event_prefix="create",
232
230
  bypass_hooks=bypass_hooks,
233
- bypass_validation=bypass_validation,
234
231
  )
235
232
 
236
233
  @transaction.atomic
@@ -240,7 +237,6 @@ class BulkOperationCoordinator:
240
237
  fields,
241
238
  batch_size=None,
242
239
  bypass_hooks=False,
243
- bypass_validation=False,
244
240
  ):
245
241
  """
246
242
  Execute bulk update with hooks.
@@ -250,7 +246,6 @@ class BulkOperationCoordinator:
250
246
  fields: List of field names to update
251
247
  batch_size: Number of objects per batch
252
248
  bypass_hooks: Skip all hooks if True
253
- bypass_validation: Skip validation hooks if True
254
249
 
255
250
  Returns:
256
251
  Number of objects updated
@@ -288,7 +283,6 @@ class BulkOperationCoordinator:
288
283
  operation=operation,
289
284
  event_prefix="update",
290
285
  bypass_hooks=bypass_hooks,
291
- bypass_validation=bypass_validation,
292
286
  )
293
287
 
294
288
  @transaction.atomic
@@ -296,7 +290,6 @@ class BulkOperationCoordinator:
296
290
  self,
297
291
  update_kwargs,
298
292
  bypass_hooks=False,
299
- bypass_validation=False,
300
293
  ):
301
294
  """
302
295
  Execute queryset.update() with full hook support.
@@ -347,13 +340,11 @@ class BulkOperationCoordinator:
347
340
  # Full hook lifecycle path
348
341
  return self._execute_queryset_update_with_hooks(
349
342
  update_kwargs=update_kwargs,
350
- bypass_validation=bypass_validation,
351
343
  )
352
344
 
353
345
  def _execute_queryset_update_with_hooks(
354
346
  self,
355
347
  update_kwargs,
356
- bypass_validation=False,
357
348
  ):
358
349
  """
359
350
  Execute queryset update with full hook lifecycle support.
@@ -364,7 +355,6 @@ class BulkOperationCoordinator:
364
355
 
365
356
  Args:
366
357
  update_kwargs: Dict of fields to update
367
- bypass_validation: Skip validation hooks if True
368
358
 
369
359
  Returns:
370
360
  Number of rows updated
@@ -424,9 +414,8 @@ class BulkOperationCoordinator:
424
414
  # Step 5: Get MTI inheritance chain
425
415
  models_in_chain = self._get_models_in_chain(self.model_cls)
426
416
 
427
- # Step 6: Run VALIDATE hooks (if not bypassed)
428
- if not bypass_validation:
429
- self._dispatch_hooks_for_models(models_in_chain, changeset, "validate_update", bypass_hooks=False)
417
+ # Step 6: Run VALIDATE hooks
418
+ self._dispatch_hooks_for_models(models_in_chain, changeset, "validate_update", bypass_hooks=False)
430
419
 
431
420
  # Step 7: Run BEFORE_UPDATE hooks with modification tracking
432
421
  modified_fields = self._run_before_update_hooks_with_tracking(
@@ -557,13 +546,12 @@ class BulkOperationCoordinator:
557
546
  QuerySet.bulk_update(fresh_qs, instances, list(modified_fields))
558
547
 
559
548
  @transaction.atomic
560
- def delete(self, bypass_hooks=False, bypass_validation=False):
549
+ def delete(self, bypass_hooks=False):
561
550
  """
562
551
  Execute delete with hooks.
563
552
 
564
553
  Args:
565
554
  bypass_hooks: Skip all hooks if True
566
- bypass_validation: Skip validation hooks if True
567
555
 
568
556
  Returns:
569
557
  Tuple of (count, details dict)
@@ -590,7 +578,6 @@ class BulkOperationCoordinator:
590
578
  operation=operation,
591
579
  event_prefix="delete",
592
580
  bypass_hooks=bypass_hooks,
593
- bypass_validation=bypass_validation,
594
581
  )
595
582
 
596
583
  def clean(self, objs, is_create=None):
@@ -681,7 +668,6 @@ class BulkOperationCoordinator:
681
668
  operation,
682
669
  event_prefix,
683
670
  bypass_hooks=False,
684
- bypass_validation=False,
685
671
  ):
686
672
  """
687
673
  Execute operation with hooks for entire MTI inheritance chain.
@@ -695,7 +681,6 @@ class BulkOperationCoordinator:
695
681
  operation: Callable that performs the actual DB operation
696
682
  event_prefix: 'create', 'update', or 'delete'
697
683
  bypass_hooks: Skip all hooks if True
698
- bypass_validation: Skip validation hooks if True
699
684
 
700
685
  Returns:
701
686
  Result of operation
@@ -723,8 +708,7 @@ class BulkOperationCoordinator:
723
708
  logger.info(f"🔗 BULK PRELOAD: No condition relationships to preload for {changeset.model_cls.__name__} hooks")
724
709
 
725
710
  # VALIDATE phase - for all models in chain
726
- if not bypass_validation:
727
- self._dispatch_hooks_for_models(models_in_chain, changeset, f"validate_{event_prefix}")
711
+ self._dispatch_hooks_for_models(models_in_chain, changeset, f"validate_{event_prefix}")
728
712
 
729
713
  # BEFORE phase - for all models in chain
730
714
  self._dispatch_hooks_for_models(models_in_chain, changeset, f"before_{event_prefix}")
@@ -105,7 +105,6 @@ class HookQuerySet(models.QuerySet):
105
105
  update_fields=None,
106
106
  unique_fields=None,
107
107
  bypass_hooks=False,
108
- bypass_validation=False,
109
108
  ):
110
109
  """
111
110
  Create multiple objects with hook support.
@@ -120,7 +119,6 @@ class HookQuerySet(models.QuerySet):
120
119
  update_fields=update_fields,
121
120
  unique_fields=unique_fields,
122
121
  bypass_hooks=bypass_hooks,
123
- bypass_validation=bypass_validation,
124
122
  )
125
123
 
126
124
  @transaction.atomic
@@ -130,7 +128,6 @@ class HookQuerySet(models.QuerySet):
130
128
  fields=None,
131
129
  batch_size=None,
132
130
  bypass_hooks=False,
133
- bypass_validation=False,
134
131
  **kwargs,
135
132
  ):
136
133
  """
@@ -143,7 +140,6 @@ class HookQuerySet(models.QuerySet):
143
140
  fields: List of field names to update (optional, will auto-detect if None)
144
141
  batch_size: Number of objects per batch
145
142
  bypass_hooks: Skip all hooks if True
146
- bypass_validation: Skip validation hooks if True
147
143
 
148
144
  Returns:
149
145
  Number of objects updated
@@ -159,11 +155,10 @@ class HookQuerySet(models.QuerySet):
159
155
  fields=fields,
160
156
  batch_size=batch_size,
161
157
  bypass_hooks=bypass_hooks,
162
- bypass_validation=bypass_validation,
163
158
  )
164
159
 
165
160
  @transaction.atomic
166
- def update(self, bypass_hooks=False, bypass_validation=False, **kwargs):
161
+ def update(self, bypass_hooks=False, **kwargs):
167
162
  """
168
163
  Update QuerySet with hook support.
169
164
 
@@ -171,7 +166,6 @@ class HookQuerySet(models.QuerySet):
171
166
 
172
167
  Args:
173
168
  bypass_hooks: Skip all hooks if True
174
- bypass_validation: Skip validation hooks if True
175
169
  **kwargs: Fields to update
176
170
 
177
171
  Returns:
@@ -180,7 +174,6 @@ class HookQuerySet(models.QuerySet):
180
174
  return self.coordinator.update_queryset(
181
175
  update_kwargs=kwargs,
182
176
  bypass_hooks=bypass_hooks,
183
- bypass_validation=bypass_validation,
184
177
  )
185
178
 
186
179
  @transaction.atomic
@@ -188,7 +181,6 @@ class HookQuerySet(models.QuerySet):
188
181
  self,
189
182
  objs,
190
183
  bypass_hooks=False,
191
- bypass_validation=False,
192
184
  **kwargs,
193
185
  ):
194
186
  """
@@ -199,7 +191,6 @@ class HookQuerySet(models.QuerySet):
199
191
  Args:
200
192
  objs: List of objects to delete
201
193
  bypass_hooks: Skip all hooks if True
202
- bypass_validation: Skip validation hooks if True
203
194
 
204
195
  Returns:
205
196
  Tuple of (count, details dict)
@@ -219,14 +210,13 @@ class HookQuerySet(models.QuerySet):
219
210
 
220
211
  count, details = coordinator.delete(
221
212
  bypass_hooks=bypass_hooks,
222
- bypass_validation=bypass_validation,
223
213
  )
224
214
 
225
215
  # For bulk_delete, return just the count to match Django's behavior
226
216
  return count
227
217
 
228
218
  @transaction.atomic
229
- def delete(self, bypass_hooks=False, bypass_validation=False):
219
+ def delete(self, bypass_hooks=False):
230
220
  """
231
221
  Delete QuerySet with hook support.
232
222
 
@@ -234,12 +224,10 @@ class HookQuerySet(models.QuerySet):
234
224
 
235
225
  Args:
236
226
  bypass_hooks: Skip all hooks if True
237
- bypass_validation: Skip validation hooks if True
238
227
 
239
228
  Returns:
240
229
  Tuple of (count, details dict)
241
230
  """
242
231
  return self.coordinator.delete(
243
232
  bypass_hooks=bypass_hooks,
244
- bypass_validation=bypass_validation,
245
233
  )
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "django-bulk-hooks"
3
- version = "0.2.76"
3
+ version = "0.2.77"
4
4
  description = "Hook-style hooks for Django bulk operations like bulk_create and bulk_update."
5
5
  authors = ["Konrad Beck <konrad.beck@merchantcapital.co.za>"]
6
6
  readme = "README.md"