You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Switching branches during development often causes mypy to invalidate its cache, leading to slow reanalysis. Additionally, branch-specific dependencies may differ, which can result in cache pollution if the environment isn't synchronized after switching branches.
Proposed Solutions
Branch-Specific Caching:
Introduce an option to include the Git branch name in the cache directory path. This would allow switching between branches (e.g., from branch-a to branch-b and back) without losing previously cached data, improving performance and reducing redundant analysis.
Pre-Execution Command:
Add an option to run a custom command before mypy execution. This would enable users to automatically sync dependencies, e.g. using uv pip sync requirements.txt. Running this command before mypy would ensure the environment matches the branch’s requirements, preventing cache corruption due to mismatched dependencies.
Benefits:
Faster mypy runs when switching branches.
Better isolation of cached data per branch.
Reduced risk of cache pollution from dependency mismatches.
Improved developer experience with automated environment checks.
Additional Context
If similar functionality exists, guidance on achieving this would be greatly appreciated.
Thank you for considering this feature request.
The text was updated successfully, but these errors were encountered:
As an alternative to Branch-Specific Caching maybe a solution would be to use the hash of the orignal py file as part of the cached json file name. We could then have an option to keep only the 5 most recent cached file for each python file for example to prevent an explosion of the cache.
Feature Request
Switching branches during development often causes mypy to invalidate its cache, leading to slow reanalysis. Additionally, branch-specific dependencies may differ, which can result in cache pollution if the environment isn't synchronized after switching branches.
Proposed Solutions
Branch-Specific Caching:
Introduce an option to include the Git branch name in the cache directory path. This would allow switching between branches (e.g., from branch-a to branch-b and back) without losing previously cached data, improving performance and reducing redundant analysis.
Pre-Execution Command:
Add an option to run a custom command before mypy execution. This would enable users to automatically sync dependencies, e.g. using
uv pip sync requirements.txt
. Running this command before mypy would ensure the environment matches the branch’s requirements, preventing cache corruption due to mismatched dependencies.Benefits:
Additional Context
If similar functionality exists, guidance on achieving this would be greatly appreciated.
Thank you for considering this feature request.
The text was updated successfully, but these errors were encountered: