File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -489,6 +489,16 @@ def get_libc_version():
489489 return '-' .join (platform .libc_ver ())
490490
491491
492+ def is_uv_venv ():
493+ if os .environ .get ("UV" ):
494+ return True
495+ pyvenv_cfg_path = os .path .join (sys .prefix , 'pyvenv.cfg' )
496+ if os .path .exists (pyvenv_cfg_path ):
497+ with open (pyvenv_cfg_path , 'r' ) as f :
498+ return any (line .startswith ('uv = ' ) for line in f )
499+ return False
500+
501+
492502def get_pip_packages (run_lambda , patterns = None ):
493503 """Return `pip list` output. Note: will also find conda-installed pytorch and numpy packages."""
494504 if patterns is None :
@@ -504,7 +514,7 @@ def run_with_pip():
504514
505515 if pip_available :
506516 cmd = [sys .executable , '-mpip' , 'list' , '--format=freeze' ]
507- elif os . environ . get ( "UV" ) is not None :
517+ elif is_uv_venv () :
508518 print ("uv is set" )
509519 cmd = ["uv" , "pip" , "list" , "--format=freeze" ]
510520 else :
You can’t perform that action at this time.
0 commit comments