Skip to content

Fix mypy type annotations in Python project templates#2405

Merged
AlexCatarino merged 2 commits into
QuantConnect:masterfrom
AlexCatarino:fix-template-type-annotations
May 13, 2026
Merged

Fix mypy type annotations in Python project templates#2405
AlexCatarino merged 2 commits into
QuantConnect:masterfrom
AlexCatarino:fix-template-type-annotations

Conversation

@AlexCatarino
Copy link
Copy Markdown
Member

Summary

  • Annotate _fundamental: list[Symbol] in the QuiverQuantCongress chained-universe template so mypy can infer the element type.
  • Use the pythonnet generic-indexer form cache.get_data[TradeBar]() in the custom-models template so the TradeBar return type carries through (avoids no-any-return).
  • Annotate _get_features_and_labels, the inner loss_mse, and on_data in the ai template so the file passes strict mypy.

Test plan

  • python project-templates/python/run_syntax_check.py — 100% pass across all 72 templates.

- Annotate `_fundamental: list[Symbol]` in the QuiverQuantCongress
  chained-universe template so mypy can infer the element type.
- Use the pythonnet generic-indexer form `cache.get_data[TradeBar]()`
  in the custom-models template so the return type carries through.
Annotate `_get_features_and_labels`, the inner `loss_mse`, and
`on_data` so the file passes the strict-mypy syntax check.
@AlexCatarino AlexCatarino merged commit f389fee into QuantConnect:master May 13, 2026
1 check passed
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