- 
                Notifications
    You must be signed in to change notification settings 
- Fork 14
FAI-978: Add ODH notebook image dependencies test to CI #145
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
          
     Open
      
      
            ruivieira
  wants to merge
  7
  commits into
  trustyai-explainability:main
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
ruivieira:FAI-978
  
      
      
   
  
    
  
  
  
 
  
      
    base: main
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
  
     Open
                    Changes from all commits
      Commits
    
    
            Show all changes
          
          
            7 commits
          
        
        Select commit
          Hold shift + click to select a range
      
      dd50f34
              
                Add ODH notebook image dependencies test to CI
              
              
                ruivieira 343cb69
              
                Add Pipfile parameter for ODH dependency check
              
              
                ruivieira 91ae9a3
              
                Replace workflow_dispatch with env variable
              
              
                ruivieira a34dca9
              
                Remove quotes
              
              
                ruivieira ba38f69
              
                Move env variable
              
              
                ruivieira a98b767
              
                Add default
              
              
                ruivieira c9c738f
              
                Correct env scope
              
              
                ruivieira File filter
Filter by extension
Conversations
          Failed to load comments.   
        
        
          
      Loading
        
  Jump to
        
          Jump to file
        
      
      
          Failed to load files.   
        
        
          
      Loading
        
  Diff view
Diff view
There are no files selected for viewing
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| name: Test dependencies match | ||
| description: Test if TrustyAI dependencies match ODH workbench images | ||
| inputs: | ||
| pipfile: | ||
| description: 'Location of the reference Pipfile' | ||
| required: true | ||
| runs: | ||
| using: "composite" | ||
| steps: | ||
| - name: Test against ODH dependencies | ||
| shell: bash | ||
| env: | ||
| INPUT_PIPFILE: ${{ inputs.pipfile }} | ||
| run: | | ||
| pytest -v -s tests/dependencies/test_odh_dependencies.py | 
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| JPype1==1.4.1 | ||
| black~=22.12.0 | ||
| click==8.0.4 | ||
| joblib~=1.2.0 | ||
| jupyterlab~=3.5.3 | ||
| numpydoc==1.5.0 | ||
| pyarrow==7.0.0 | ||
| pylint==2.15.6 | ||
| pytest~=7.2.1 | ||
| pytest-benchmark==4.0.0 | ||
| pytest-forked~=1.6.0 | ||
| scikit-learn~=1.2.1 | ||
| setuptools | ||
| twine==3.4.2 | ||
| wheel~=0.38.4 | ||
| xgboost==1.4.2 | ||
| dparse==0.6.2 | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| JPype1==1.4.1 | ||
| matplotlib==3.5.1 | ||
| pandas==1.2.5 | ||
| Jpype1==1.4.1 | ||
| pyarrow==7.0.0 | ||
| bokeh==2.4.3 | ||
| matplotlib~=3.6.3 | ||
| pandas~=1.5.3 | ||
| numpy~=1.24.1 | ||
| jupyter-bokeh~=3.0.5 | 
  
    
      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
    
  
  
    
              | Original file line number | Diff line number | Diff line change | 
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| import os | ||
| import urllib.request | ||
| from dparse import parse, filetypes | ||
|  | ||
| DEFAULT_PIPFILE = "https://raw.githubusercontent.com/opendatahub-io/notebooks/main/jupyter/datascience/ubi9-python-3.9/Pipfile" | ||
| INPUT_PIPFILE = os.getenv("INPUT_PIPFILE", DEFAULT_PIPFILE) | ||
|  | ||
|  | ||
| def test_odh_dependencies(): | ||
| '''Tests whether TrustyAI's dependencies are compatible with ODH workbench-image's https://github.com/opendatahub-io/notebooks/tree/main/jupyter/datascience/ubi9-python-3.9''' | ||
| # download the pipfile | ||
| urllib.request.urlretrieve(INPUT_PIPFILE, "/tmp/Pipfile") | ||
|  | ||
| with open('./requirements.txt', 'r') as file: | ||
| reqtxt = parse(file.read(), file_type=filetypes.requirements_txt) | ||
|  | ||
| with open('./requirements-dev.txt', 'r') as file: | ||
| reqdevtxt = parse(file.read(), file_type=filetypes.requirements_txt) | ||
|  | ||
| with open('/tmp/Pipfile', 'r') as file: | ||
| pipfile = parse(file.read(), file_type=filetypes.pipfile) | ||
|  | ||
| reqtxt_names = {dependency.name: dependency for dependency in reqtxt.dependencies} | ||
| reqdevtxt_names = {dependency.name: dependency for dependency in reqdevtxt.dependencies} | ||
|  | ||
| mismatched_specs = [] | ||
|  | ||
| for dependency in pipfile.dependencies: | ||
| if dependency.name in reqtxt_names.keys(): | ||
| print(f"{dependency} found") | ||
| trusty_specs = reqtxt_names[dependency.name].specs | ||
| if dependency.specs == trusty_specs: | ||
| print(f"\tSpecs match ({dependency.specs})") | ||
| else: | ||
| print( | ||
| f"\tSpecs do not match ({dependency.specs} ODH vs. {reqtxt_names[dependency.name].specs} TrustyAI)") | ||
| mismatched_specs.append(dependency) | ||
| if dependency.name in reqdevtxt_names.keys(): | ||
| print(f"{dependency} found") | ||
| trusty_specs = reqdevtxt_names[dependency.name].specs | ||
| if dependency.specs == trusty_specs: | ||
| print(f"\tSpecs match ({dependency.specs})") | ||
| else: | ||
| print( | ||
| f"\tSpecs do not match ({dependency.specs} ODH vs. {reqtxt_names[dependency.name].specs} TrustyAI)") | ||
| mismatched_specs.append(dependency) | ||
|  | ||
| assert len(mismatched_specs) == 0 | ||
  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.
  
    
  
    
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.
Is it possible to print the current
INPUT_PIPFILEvalue or the test description must be a constant?