Add generation dependency index#3154
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (13)
📝 WalkthroughWalkthroughThis PR introduces a controlled mutation system for the parser's model-graph construction via a new ChangesGeneration Store Model Graph State Management
Sequence DiagramssequenceDiagram
participant Parser
participant Store as GenerationStore
participant Index as GenerationIndex
participant Model
Parser->>Store: create_with_results()
Parser->>Store: register_model(model)
Parser->>Store: replace_field_type(field, new_type)
Store->>Store: defer_refresh()
Store->>Index: rebuild facts snapshot
Index-->>Store: provide reference classes
Store-->>Parser: return query results
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested labels
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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 |
|
📚 Docs Preview: https://pr-3154.datamodel-code-generator.pages.dev |
Merging this PR will improve performance by 16.55%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | WallTime | test_perf_large_models_pydantic_v2 |
3.9 s | 3.3 s | +20% |
| ⚡ | WallTime | test_perf_duplicate_names |
1,064.8 ms | 934.4 ms | +13.96% |
| ⚡ | WallTime | test_perf_aws_style_openapi_pydantic_v2 |
1.9 s | 1.7 s | +13.31% |
| ⚡ | WallTime | test_perf_graphql_style_pydantic_v2 |
835 ms | 744.3 ms | +12.19% |
| ⚡ | WallTime | test_perf_kubernetes_style_pydantic_v2 |
2.7 s | 2.4 s | +11.8% |
| ⚡ | WallTime | test_perf_complex_refs |
2.2 s | 1.9 s | +15.2% |
| ⚡ | WallTime | test_perf_stripe_style_pydantic_v2 |
2 s | 1.8 s | +10.8% |
| ⚡ | WallTime | test_perf_deep_nested |
6.2 s | 4.8 s | +30.69% |
| ⚡ | WallTime | test_perf_multiple_files_input |
3.8 s | 3.3 s | +13.49% |
| ⚡ | WallTime | test_perf_openapi_large |
3 s | 2.6 s | +14.1% |
| ⚡ | WallTime | test_perf_all_options_enabled |
6.6 s | 5.1 s | +28.4% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feature/generation-store-index (09f3e41) with main (5b66f67)
Footnotes
-
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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3154 +/- ##
==========================================
Coverage 100.00% 100.00%
==========================================
Files 89 92 +3
Lines 18650 19346 +696
Branches 2156 2203 +47
==========================================
+ Hits 18650 19346 +696
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Breaking Change AnalysisResult: No breaking changes detected Reasoning: PR #3154 is an internal refactoring that introduces a GenerationStore/GenerationIndex abstraction layer for centralizing parser mutations. All changes are additive and backward compatible: new function parameters default to None, Parser.results remains list-compatible (using a list subclass), no CLI arguments or generated output formats changed, no public API was removed or renamed. The module docstring explicitly states "preserve output compatibility first." The only enforcement mechanism (a pre-commit hook for store usage) applies only to parser contributors, not end users. This analysis was performed by Claude Code Action |
|
🎉 Released in 0.58.0 This PR is now available in the latest release. See the release notes for details. |
Summary by CodeRabbit
Release Notes
New Features
Documentation
Tests