Skip to content

Read the pyproject values of preset items in one place - #5663

Merged
Koudai Aono (koxudaxi) merged 1 commit into
impl-c10from
impl-c28
Oct 30, 2026
Merged

Koudai Aono (koxudaxi) merged 1 commit into
impl-c10from
impl-c28

Conversation

@koxudaxi

@koxudaxi Koudai Aono (koxudaxi) commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Summary by CodeRabbit

  • Documentation

    • Clarified how preset configuration values are represented and where they are sourced.
  • Consistency

    • Preset values are now interpreted consistently across configuration handling and recommendation workflows, preserving their order and pyproject-formatted values.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T15:21:30.256083Z ef63cd6 PR opened
ℹ️ About Codex in GitHub

Your 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.

@coderabbitai

coderabbitai Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between e2b1f09 and ef63cd6.

Files ignored due to path filters: 1
  • docs/llms-full.txt is excluded by none and included by none
Files selected for processing: 6
  • docs/architecture.md
  • scripts/decision_homes.toml
  • scripts/recommender_calibrate.py
  • src/datamodel_code_generator/_recommend/__init__.py
  • src/datamodel_code_generator/_recommend/_rules.py
  • src/datamodel_code_generator/preset.py

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 5 remain after this review.

Walkthrough

Preset items now use a shared helper to produce field-name-keyed, pyproject-formatted values. Recommender, calibration, and configuration-copying code use the helper. Architecture and decision records identify the helper as the source of these values.

Changes: Preset value conversion

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: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor

Possibly related issues

Possibly related PRs

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: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: centralizing reads of pyproject values for preset items.
Docstring Coverage Passed 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. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
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.

❤️ Share

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

@github-actions

Copy link
Copy Markdown
Contributor

@codspeed

codspeed Bot commented Oct 30, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 41.92%

2 warnings

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚠️ 52 benchmarks with a significant change ran on different hardware

Their base and head results were measured on machines with a different CPU, core count or memory, so the changes might not come from the code. Run base and head on the same runner type.

Learn more about Macro Runners

See affected benchmarks

❌ 52 regressed benchmarks
⏩ 98 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Benchmark BASE HEAD Efficiency
❌ test_perf_openapi_large_pydantic_v2_builtin 630.5 ms 1,192.4 ms -47.12%
❌ test_perf_simple_msgspec_unset_field_rendering 238.9 ms 449.7 ms -46.88%
❌ test_perf_load_yaml_openapi_large 18.2 ms 34.1 ms -46.63%
❌ test_perf_kubernetes_style_pydantic_v2 1.3 s 2.4 s -45.93%
❌ test_perf_openapi_large 1.5 s 2.8 s -45.87%
❌ test_perf_inherited_required_fields[partial-base-first] 486.2 ms 889.9 ms -45.36%
❌ test_perf_false_reference_validation 126 ms 229.8 ms -45.17%
❌ test_perf_inherited_required_fields[required-base-first] 298.5 ms 542.9 ms -45.01%
❌ test_perf_duplicate_names 500.2 ms 906 ms -44.79%
❌ test_perf_unique_items_nested_model_validation 1.6 ms 2.8 ms -44.66%
❌ test_perf_aws_style_openapi_pydantic_v2 1 s 1.9 s -44.63%
❌ test_perf_ordinary_array_constraint_generation 941.6 ms 1,694.4 ms -44.43%
❌ test_perf_complex_refs 969.6 ms 1,743.6 ms -44.39%
❌ test_perf_large_models_typed_dict[legacy-requiredness] 556.1 ms 999.5 ms -44.37%
❌ test_perf_graphql_style_pydantic_v2 401.5 ms 721.3 ms -44.34%
❌ test_perf_scalar_root_collapsed_builtin 96.7 ms 173.6 ms -44.29%
❌ test_perf_stripe_style_pydantic_v2 998.1 ms 1,791 ms -44.27%
❌ test_perf_client_calls[sync] 17.8 ms 31.9 ms -44.19%
❌ test_perf_multiple_files_input 1.8 s 3.3 s -44.15%
❌ test_perf_large_models_pydantic_v2_builtin 624.8 ms 1,116.6 ms -44.04%
... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing impl-c28 (ef63cd6) with impl-c10 (e2b1f09)

Open in CodSpeed

Footnotes

  1. 98 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@codecov

codecov Bot commented Oct 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@koxudaxi
Koudai Aono (koxudaxi) merged commit 35de284 into main Oct 30, 2026
163 of 164 checks passed
@koxudaxi
Koudai Aono (koxudaxi) deleted the impl-c28 branch October 30, 2026 15:44
@github-actions

Copy link
Copy Markdown
Contributor

Breaking Change Analysis

Result: 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

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

🎉 Released in 0.88.0

This PR is now available in the latest release. See the release notes for details.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant