Repository navigation
Read the pyproject values of preset items in one place - #5663
Conversation
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Shared pyproject value conversion src/datamodel_code_generator/preset.py |
Adds _pyproject_values to map preset items to field-name-keyed pyproject values. _copyable_config_data uses this helper. |
Preset readers and decision records scripts/recommender_calibrate.py, src/datamodel_code_generator/_recommend/*, scripts/decision_homes.toml, docs/architecture.md |
Recommender and calibration code use _pyproject_values to convert preset items. The decision record and architecture table identify the helper as the source of preset values. |
Priority:
Estimated code review effort: 2 (Simple) | ~10 minutes
Change: Refactor
Possibly related issues
- Empty list or tuple option value is written as a bare flag in generated commands #5589: The issue concerns serialization of preset option values. This change routes preset-value readers through a shared pyproject-value conversion helper.
Possibly related PRs
- datamodel-code-generator/datamodel-code-generator#5566: This PR continues the earlier centralization of preset resolution by routing readers through a shared conversion helper.
- datamodel-code-generator/datamodel-code-generator#5330: This PR centralizes conversion of preset items that require pyproject spelling.
Merge Risk: 
Minimal · up to ef63c
-
No merge-blocking issue is identified in this refactor. The change appears ready to merge subject to normal checks.
Pre-merge checks: 
5
-
Full details: Docstring Coverage
-
Explanation
Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 3 functions across 4 files. (2 skipped: 2 unsupported.)
-
Finishing Touches: 💡 1
-
📝 Generate docstrings
-
- Commit to this branch
- Create a new PR
🧪 Generate unit tests (beta)
-
- Commit to this branch
- Create a new PR
🛠️ Fix failing CI checks: 💡
-
- Commit to this branch
- Create a new PR
-
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Merging this PR will degrade performance by 41.92%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Breaking Change AnalysisResult: No breaking changes detected Reasoning: The prepared diff is an internal refactor only. It adds a private helper, _pyproject_values in preset.py, that builds a dict of preset config item values keyed by field name using each item's pyproject_value. Four places that used to build this dict inline now call the helper: _recommend/init.py _preset_values, _recommend/_rules.py _rule_values, preset.py _copyable_config_data and scripts/recommender_calibrate.py. The other changes are a TYPE_CHECKING import, a new decision-homes entry and new architecture doc rows. The removed lines are just the old inline loops, and the helper returns the same mapping in the same order. In _copyable_config_data, the old loop assigned keys one by one and the new code uses dict update, which gives the same result before sorting. No public CLI options, Python APIs, templates, defaults, error handling or Python version support are changed or removed. The behaviour diff gate does list accepted cells, but they compare against the last release, so they include changes from earlier PRs. All of them are about allOf schemas whose parts admit no object, which now become root models or aliases. The gate notes themselves credit an earlier allOf change for them, and nothing in this diff touches parsing or model generation, so they are not caused by this PR. The rest of the gate cells are both-fail or crash-fix and do not change behaviour. This analysis was produced by the release draft workflow |
|
🎉 Released in 0.88.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
Documentation
Consistency