Skip to content

chore(mypy): enable strict type checking for core distribution/stack files#5484

Merged
leseb merged 1 commit intollamastack:mainfrom
Elbehery:20260408_mypy_type_checks_lls_core
Apr 16, 2026
Merged

chore(mypy): enable strict type checking for core distribution/stack files#5484
leseb merged 1 commit intollamastack:mainfrom
Elbehery:20260408_mypy_type_checks_lls_core

Conversation

@Elbehery
Copy link
Copy Markdown
Contributor

@Elbehery Elbehery commented Apr 8, 2026

What does this PR do?

enable strict type checking for core distribution/stack files

  • src/llama_stack/core/stack.py - Fixed type narrowing issues

Key changes in stack.py:

  • Added type: ignore comments for result variable reuse across branches
  • The replace_env_vars() function uses result differently in each branch (dict/list/str), which mypy cannot track across control flow
  • Added type: ignore for deps parameter - implementations expect dict[str, Any] but receive dict[Api, Any] where Api is an enum (runtime compatible)
  • Added type annotation for provider_configs_by_api

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Apr 8, 2026
@Elbehery Elbehery force-pushed the 20260408_mypy_type_checks_lls_core branch 4 times, most recently from d46c50c to 9fb4080 Compare April 9, 2026 14:03
Copy link
Copy Markdown
Collaborator

@leseb leseb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR is mostly ignoring and not really fixing, at least let's leave an explanation on why we ignore

@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Apr 13, 2026

This pull request has merge conflicts that must be resolved before it can be merged. @Elbehery please rebase it. https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Apr 13, 2026
@Elbehery Elbehery force-pushed the 20260408_mypy_type_checks_lls_core branch from 9fb4080 to 961f7d5 Compare April 13, 2026 11:42
@mergify mergify Bot removed the needs-rebase label Apr 13, 2026
@Elbehery Elbehery force-pushed the 20260408_mypy_type_checks_lls_core branch 2 times, most recently from 364938b to 52b92d1 Compare April 13, 2026 12:15
Comment thread pyproject.toml Outdated
@Elbehery Elbehery force-pushed the 20260408_mypy_type_checks_lls_core branch 4 times, most recently from 18847eb to 1ebd71d Compare April 14, 2026 13:57
@leseb leseb added this pull request to the merge queue Apr 16, 2026
@github-merge-queue github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Apr 16, 2026
…files

- src/llama_stack/core/stack.py - Fixed type narrowing issues

Key changes in stack.py:
- Added type: ignore comments for result variable reuse across branches
- The replace_env_vars() function uses result differently in each branch
  (dict/list/str), which mypy cannot track across control flow
- Added type: ignore for deps parameter - implementations expect dict[str, Any]
  but receive dict[Api, Any] where Api is an enum (runtime compatible)
- Added type annotation for provider_configs_by_api

Signed-off-by: Mustafa Elbehery <melbeher@redhat.com>
@Elbehery Elbehery force-pushed the 20260408_mypy_type_checks_lls_core branch from 1ebd71d to 1af39d2 Compare April 16, 2026 13:11
@Elbehery
Copy link
Copy Markdown
Contributor Author

@leseb rebased and updated, please re-approve and re-add 👍🏽

@leseb leseb added this pull request to the merge queue Apr 16, 2026
Merged via the queue into llamastack:main with commit 9555add Apr 16, 2026
99 checks passed
@Elbehery Elbehery deleted the 20260408_mypy_type_checks_lls_core branch April 16, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants