Skip to content

[CI] Fix mypy errors#2672

Merged
hickeyma merged 3 commits intoLMCache:devfrom
hickeyma:fix-mypy
Mar 4, 2026
Merged

[CI] Fix mypy errors#2672
hickeyma merged 3 commits intoLMCache:devfrom
hickeyma:fix-mypy

Conversation

@hickeyma
Copy link
Copy Markdown
Collaborator

@hickeyma hickeyma commented Mar 3, 2026

What this PR does / why we need it:

mypy is broken with the following errors:

mypy.....................................................................Failed
- hook id: mypy
- exit code: 1

lmcache/v1/periodic_thread.py:411: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/check/__init__.py:20: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_kv_layer_groups_manager.py:19: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/mp_observability/test_storage_manager_stats_logger.py:197: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/mp_observability/test_storage_manager_stats_logger.py:222: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/mp_observability/test_l1_stats_logger.py:139: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/usage_context.py:343: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:271: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:281: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:282: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:285: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:305: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:306: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:307: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:313: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:316: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:317: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:318: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:319: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/observability.py:320: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:258: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:278: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:456: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:457: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:505: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:544: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:546: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:626: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_address_manager.py:629: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/storage_backend/cache_policy/lru.py:23: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:52: error: Module has no attribute "eventfd"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:52: error: Module has no attribute "EFD_NONBLOCK"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:52: error: Module has no attribute "EFD_CLOEXEC"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:53: error: Module has no attribute "eventfd"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:53: error: Module has no attribute "EFD_NONBLOCK"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:53: error: Module has no attribute "EFD_CLOEXEC"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:54: error: Module has no attribute "eventfd"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:54: error: Module has no attribute "EFD_NONBLOCK"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:54: error: Module has no attribute "EFD_CLOEXEC"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:298: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:355: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/l2_adapters/mock_l2_adapter.py:372: error: Module has no attribute "eventfd_write"  [attr-defined]
tests/v1/distributed/test_mock_l2_adapter.py:69: error: Module has no attribute "eventfd_read"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:53: error: Module has no attribute "eventfd"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:53: error: Module has no attribute "EFD_NONBLOCK"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:53: error: Module has no attribute "EFD_CLOEXEC"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:93: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:202: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/storage_controllers/store_controller.py:236: error: Module has no attribute "eventfd_read"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:214: error: Module has no attribute "eventfd"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:214: error: Module has no attribute "EFD_NONBLOCK"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:214: error: Module has no attribute "EFD_CLOEXEC"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:269: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:306: error: Module has no attribute "eventfd_write"  [attr-defined]
lmcache/v1/distributed/storage_controllers/prefetch_controller.py:339: error: Module has no attribute "eventfd_read"  [attr-defined]
lmcache/v1/storage_backend/batched_message_sender.py:156: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/storage_backend/test_remote_storage_plugin.py:40: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/storage_backend/test_remote_storage_plugin.py:41: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/cache_controller/utils.py:356: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/cache_controller/utils.py:363: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/v1/cache_controller/utils.py:365: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_gpu_connector.py:261: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_gpu_connector.py:262: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_gpu_connector.py:263: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_gpu_connector.py:264: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/storage_backend/test_local_cpu_backend.py:557: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/storage_backend/test_local_cpu_backend.py:592: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/tools/controller_benchmark/benchmark.py:493: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/tools/controller_benchmark/benchmark.py:496: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/tools/controller_benchmark/benchmark.py:497: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
lmcache/tools/controller_benchmark/benchmark.py:500: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_vllm_layerwise_wait_for_save.py:30: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_vllm_layerwise_wait_for_save.py:31: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/v1/test_vllm_layerwise_wait_for_save.py:32: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
tests/tools/test_controller_zmq_benchmark.py:433: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs  [annotation-unchecked]
Found 25 errors in 4 files (checked 458 source files)

Special notes for your reviewers:

If applicable:

  • this PR contains user facing changes - docs added
  • this PR contains unit tests

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
@hickeyma hickeyma added the bug Something isn't working label Mar 3, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses continuous integration failures stemming from mypy type checking errors. The core issue was attr-defined errors for eventfd related functions, which are typically Linux-specific. By explicitly configuring mypy to target the linux platform, these errors are resolved, ensuring the CI pipeline passes correctly.

Highlights

  • Mypy Configuration Fix: Added platform = "linux" to the [tool.mypy] section in pyproject.toml to resolve attr-defined errors related to eventfd functions, which were causing CI failures.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • pyproject.toml
    • Configured mypy to target the 'linux' platform.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@hickeyma hickeyma added the ci/cd label Mar 3, 2026
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses the mypy attr-defined errors by configuring mypy to run in a Linux environment. Adding platform = "linux" to the pyproject.toml ensures that mypy correctly resolves Linux-specific attributes like eventfd and related functions, which were previously causing type-checking failures. This is an appropriate fix for the reported issues.

Note: Security Review has been skipped due to the limited scope of the PR.

Copy link
Copy Markdown
Collaborator

@DongDongJu DongDongJu left a comment

Choose a reason for hiding this comment

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

LGTM

@hickeyma hickeyma enabled auto-merge (squash) March 3, 2026 19:19
@github-actions github-actions Bot added the full Run comprehensive tests on this PR label Mar 3, 2026
@hickeyma hickeyma merged commit db8d63c into LMCache:dev Mar 4, 2026
23 of 24 checks passed
hlin99 pushed a commit to hlin99/LMCache that referenced this pull request Mar 4, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
@hickeyma hickeyma deleted the fix-mypy branch March 4, 2026 07:31
mauryaavinash95 pushed a commit to mauryaavinash95/LMCache that referenced this pull request Mar 7, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
shaoxiawjc pushed a commit to shaoxiawjc/LMCache that referenced this pull request Mar 11, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: shaoxiawjc <wjc2800@163.com>
realAaronWu pushed a commit to realAaronWu/LMCache that referenced this pull request Mar 20, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Signed-off-by: Aaron Wu <aaron.wu@dell.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
jooho-XCENA pushed a commit to xcena-dev/LMCache that referenced this pull request Apr 2, 2026
Fix mypy errors

Signed-off-by: Martin Hickey <martin.hickey@ie.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working ci/cd full Run comprehensive tests on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants