- 
                Notifications
    
You must be signed in to change notification settings  - Fork 1.2k
 
fix(mypy): add type stubs and fix typing issues #3938
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
          
     Merged
      
      
    
                
     Merged
            
            
          Conversation
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
    
              
                    leseb
  
              
              reviewed
              
                  
                    Oct 28, 2025 
                  
              
              
            
            
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm fine with the ignore, we should just leave an explanation either in code or in commit message, thanks!
              
                    raghotham
  
              
              approved these changes
              
                  
                    Oct 28, 2025 
                  
              
              
            
            
e7179e8    to
    021e669      
    Compare
  
    675b005    to
    99380de      
    Compare
  
    Create a new type_checking dependency group that includes: - All type stubs (moved from dev group for better organization) - Optional runtime dependencies needed for complete mypy coverage (streamlit, anthropic, databricks-sdk, fairscale, torchtune, etc.) This reduces mypy errors from 73 to 59 by providing proper type information for all optional features. The dev group is now cleaner with only actual development tools. To run mypy with full type coverage: uv run --group dev --group type_checking mypy 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Add lm-format-enforcer to type_checking dependencies and update the pre-commit mypy hook to use local repo with uv run --group dev --group type_checking for better integration with dependency groups. This reduces mypy errors from 73 to 58 (one additional error fixed).
… files This commit achieves zero mypy errors across all 430 source files by addressing type issues in post-training providers, model implementations, and testing infrastructure. Key changes: - Created HFAutoModel Protocol for HuggingFace models to provide type safety without requiring complete type stubs - Added module overrides in pyproject.toml for libraries lacking type stubs (torchtune, fairscale, torchvision, datasets, etc.) - Fixed type issues in databricks provider and api_recorder Using centralized mypy.overrides instead of scattered inline suppressions provides cleaner code organization.
021e669    to
    d112e63      
    Compare
  
    
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment
  
      
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
Adds type stubs and fixes mypy errors for better type coverage.
Changes:
Note: ~1,200 errors remain in excluded files (see pyproject.toml exclude list).