Skip to content

Conversation

@amureki
Copy link
Member

@amureki amureki commented Jan 21, 2026

Describe the change
Allows baker.make(Model, _bulk_create=True) to work without specifying _quantity. In this case it returns a single object (not a list), which is consistent with the usual make() behavior.

PR Checklist

  • Change is covered with tests
  • CHANGELOG.md is updated if needed

Summary by CodeRabbit

  • New Features
    • The _bulk_create parameter can now be used independently without requiring _quantity specification, returning a single created instance when _quantity is not provided.

✏️ Tip: You can customize this high-level summary in your review settings.

@amureki amureki self-assigned this Jan 21, 2026
@coderabbitai
Copy link

coderabbitai bot commented Jan 21, 2026

📝 Walkthrough

Walkthrough

This pull request modifies the baker.make method to support _bulk_create=True without requiring an explicit _quantity parameter. When _quantity is None, bulk_create is invoked with a default quantity of 1 and returns a single instance. When _quantity is provided, the method returns a list. A corresponding test case and changelog entry document this behavioral change.

Changes

Cohort / File(s) Summary
Core Implementation
model_bakery/baker.py
Modified Baker.make to always call bulk_create when _bulk_create is True, regardless of _quantity. Returns a single instance (result[0]) when _quantity is None, or the full list when _quantity is provided.
Test Coverage
tests/test_baker.py
Added test_make_bulk_create_without_quantity to verify bulk_create is invoked when _bulk_create=True and _quantity is None, confirming a valid Person instance is returned.
Documentation
CHANGELOG.md
Documented that _bulk_create can now be used with True without requiring _quantity.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 A baker's twist, so clean and bright,
No \_quantity needed, the logic feels right!
One bulk create call, a list or alone,
The baker now serves with more finesse shown. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title directly relates to the main change: allowing _bulk_create=True without _quantity. It references the fixed issue #462 and clearly summarizes the primary enhancement.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Comment @coderabbitai help to get the list of available commands and usage tips.

@amureki amureki merged commit 8f6c9b7 into main Jan 21, 2026
45 checks passed
@amureki amureki deleted the 462/bulk-create-without-quantity branch January 21, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants