Skip to content

[ty] Support multiple analysis environments in one database#26369

Draft
MichaReiser wants to merge 1 commit into
mainfrom
micha/multi-environment-scroll-analysis
Draft

[ty] Support multiple analysis environments in one database#26369
MichaReiser wants to merge 1 commit into
mainfrom
micha/multi-environment-scroll-analysis

Conversation

@MichaReiser

Copy link
Copy Markdown
Member

Summary

Allow one project database to analyze files under multiple Python versions, platforms, search paths, and inference settings while sharing physical source data.
Carry environment identity through parsing, module resolution, and type inference without relying on an ambient singleton.

Test Plan

Testing: Added multi-environment coverage and ran focused tests, Clippy, repository hooks, and performance benchmarks.

@astral-sh-bot

astral-sh-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

Typing conformance results

No changes detected ✅

Current numbers
The percentage of diagnostics emitted that were expected errors held steady at 94.47%. The percentage of expected errors that received a diagnostic held steady at 89.19%. The number of fully passing files held steady at 95/134.

@astral-sh-bot

astral-sh-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

Memory usage report

Summary

Project Old New Diff Outcome
prefect 447.93MB 461.19MB +2.96% (13.26MB)
sphinx 166.53MB 170.75MB +2.53% (4.21MB)
trio 70.21MB 71.61MB +2.00% (1.40MB)
flake8 28.93MB 29.25MB +1.10% (325.24kB)

Significant changes

Click to expand detailed breakdown

prefect

Name Old New Diff Outcome
semantic_index_in_environment 0.00B 113.90MB +113.90MB (new)
semantic_index 113.87MB 0.00B -100.00% (113.87MB)
parsed_module_versioned 0.00B 19.48MB +19.48MB (new)
parsed_module 19.48MB 0.00B -100.00% (19.48MB)
infer_definition_types 49.91MB 55.41MB +11.01% (5.50MB)
infer_expression_types_impl 37.77MB 41.30MB +9.35% (3.53MB)
infer_scope_types_impl 30.11MB 31.25MB +3.78% (1.14MB)
all_narrowing_constraints_for_expression 5.14MB 5.66MB +10.14% (533.77kB)
infer_deferred_types 5.99MB 6.36MB +6.19% (379.48kB)
function_known_decorators 3.04MB 3.30MB +8.79% (273.11kB)
member_lookup_with_policy_inner 10.21MB 10.42MB +2.03% (212.82kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 809.71kB 962.27kB +18.84% (152.56kB)
FunctionType<'db>::signature_ 2.56MB 2.70MB +5.81% (152.02kB)
Type<'db>::apply_specialization_inner_ 2.03MB 2.17MB +6.98% (145.09kB)
AnalysisFile 0.00B 144.07kB +144.07kB (new)
... 76 more

sphinx

Name Old New Diff Outcome
semantic_index_in_environment 0.00B 37.31MB +37.31MB (new)
semantic_index 37.29MB 0.00B -100.00% (37.29MB)
parsed_module_versioned 0.00B 18.51MB +18.51MB (new)
parsed_module 18.51MB 0.00B -100.00% (18.51MB)
infer_definition_types 13.67MB 15.12MB +10.64% (1.45MB)
infer_expression_types_impl 14.77MB 15.89MB +7.63% (1.13MB)
infer_scope_types_impl 8.10MB 8.39MB +3.62% (300.47kB)
infer_deferred_types 2.67MB 2.91MB +8.80% (240.87kB)
all_narrowing_constraints_for_expression 1.89MB 2.07MB +9.20% (178.51kB)
StaticClassLiteral<'db>::implicit_attribute_inner_ 605.73kB 733.19kB +21.04% (127.45kB)
member_lookup_with_policy_inner 4.28MB 4.37MB +2.06% (90.31kB)
FunctionType<'db>::signature_ 1.61MB 1.69MB +4.90% (80.61kB)
Type<'db>::class_member_with_policy_ 3.60MB 3.67MB +1.90% (70.11kB)
Type<'db>::apply_specialization_inner_ 1.04MB 1.10MB +6.27% (66.46kB)
AnalysisFile 0.00B 64.27kB +64.27kB (new)
... 76 more

trio

Name Old New Diff Outcome
semantic_index_in_environment 0.00B 17.69MB +17.69MB (new)
semantic_index 17.69MB 0.00B -100.00% (17.69MB)
parsed_module_versioned 0.00B 15.17MB +15.17MB (new)
parsed_module 15.17MB 0.00B -100.00% (15.17MB)
infer_definition_types 3.96MB 4.42MB +11.50% (466.62kB)
infer_expression_types_impl 4.37MB 4.78MB +9.41% (420.64kB)
infer_deferred_types 1.20MB 1.30MB +9.00% (110.27kB)
infer_scope_types_impl 2.40MB 2.50MB +4.17% (102.64kB)
all_narrowing_constraints_for_expression 451.09kB 487.16kB +8.00% (36.07kB)
FunctionType<'db>::signature_ 626.11kB 659.31kB +5.30% (33.20kB)
Type<'db>::apply_specialization_inner_ 350.20kB 377.94kB +7.92% (27.74kB)
member_lookup_with_policy_inner 1.03MB 1.05MB +2.19% (22.97kB)
function_known_decorators 236.04kB 256.83kB +8.81% (20.79kB)
AnalysisFile 0.00B 18.91kB +18.91kB (new)
ProgramFile 0.00B 18.00kB +18.00kB (new)
... 66 more

flake8

Name Old New Diff Outcome
parsed_module_versioned 0.00B 9.86MB +9.86MB (new)
parsed_module 9.86MB 0.00B -100.00% (9.86MB)
semantic_index_in_environment 0.00B 7.85MB +7.85MB (new)
semantic_index 7.85MB 0.00B -100.00% (7.85MB)
infer_definition_types 1000.59kB 1.08MB +10.97% (109.73kB)
infer_expression_types_impl 642.02kB 699.94kB +9.02% (57.92kB)
infer_scope_types_impl 512.00kB 532.57kB +4.02% (20.58kB)
infer_deferred_types 285.61kB 305.38kB +6.92% (19.77kB)
ResolverProgram 0.00B 14.86kB +14.86kB (new)
Program 14.95kB 133.00B -99.13% (14.82kB)
AnalysisFile 0.00B 9.70kB +9.70kB (new)
Type<'db>::class_member_with_policy_ 236.53kB 245.96kB +3.99% (9.43kB)
ProgramFile 0.00B 9.07kB +9.07kB (new)
FunctionType<'db>::signature_ 243.76kB 252.47kB +3.57% (8.71kB)
Type<'db>::apply_specialization_inner_ 119.18kB 127.84kB +7.26% (8.66kB)
... 57 more

@astral-sh-bot

astral-sh-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

ecosystem-analyzer results

No diagnostic changes detected ✅

Flaky changes detected. This PR summary excludes flaky changes; see the HTML report for details.

Full report with detailed diff (timing results)

@astral-sh-bot

astral-sh-bot Bot commented Jun 25, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@codspeed-hq

codspeed-hq Bot commented Jun 25, 2026

Copy link
Copy Markdown

Merging this PR will degrade performance by 5%

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 4 regressed benchmarks
✅ 129 untouched benchmarks
⏩ 4 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
Memory ty_check_file[cold] 14.8 MB 15.8 MB -6.24%
WallTime sympy 75.8 s 79.9 s -5.06%
Simulation ty_check_file[incremental] 5.6 ms 5.9 ms -4.61%
WallTime freqtrade 10.4 s 10.9 s -4.07%

Tip

Investigate this regression with the CodSpeed MCP and your agent.


Comparing micha/multi-environment-scroll-analysis (962f5ea) with main (dbe6e98)

Open in CodSpeed

Footnotes

  1. 4 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.

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.

1 participant