@@ -30,7 +30,7 @@ def try_extract_super_gradients_version_from_pip_install_command(input: str) ->
3030 :param input: A string that contains a `!pip install super_gradients=={version}` command.
3131 :return: The version of super_gradients.
3232 """
33- pattern = re .compile (r"pip\s+install.*?super- gradients==([0-9]+(?:\.[0-9]+)*(?:\.[0-9]+)?)" )
33+ pattern = re .compile (r"pip\s+install.*?super[-_] gradients==([0-9]+(?:\.[0-9]+)*(?:\.[0-9]+)?)" )
3434 match = re .search (pattern , input )
3535 if match :
3636 return match .group (1 )
@@ -46,22 +46,24 @@ def main():
4646 """
4747 notebook_path = sys .argv [1 ]
4848 first_cell_content = get_first_cell_content (notebook_path )
49- print (first_cell_content )
5049
50+ expected_version = super_gradients .__version__
5151 for line in first_cell_content .splitlines ():
5252 sg_version_in_notebook = try_extract_super_gradients_version_from_pip_install_command (line )
5353 if sg_version_in_notebook is not None :
54- if sg_version_in_notebook == super_gradients . __version__ :
54+ if sg_version_in_notebook == expected_version :
5555 return 0
5656 else :
5757 print (
58- f"Version mismatch detected:\n "
59- f"super_gradients.__version__ is { super_gradients . __version__ } \n "
58+ f"Version mismatch detected in { notebook_path } :\n "
59+ f"super_gradients.__version__ is { expected_version } \n "
6060 f"Notebook uses super_gradients { sg_version_in_notebook } (notebook_path)"
6161 )
6262 return 1
6363
64- print ("First code cell of the notebook does not contain a `!pip install super_gradients=={version} command`" )
64+ print (f"First code cell of the notebook { notebook_path } does not contain a `!pip install super_gradients=={ expected_version } command`" )
65+ print ("First code cell content:" )
66+ print (first_cell_content )
6567 return 1
6668
6769
0 commit comments