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
Copy file name to clipboardExpand all lines: src/py.erl
+20-9Lines changed: 20 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -490,6 +490,11 @@ parallel(Calls) when is_list(Calls) ->
490
490
%% This modifies sys.path to use packages from the specified venv.
491
491
%% The venv path should be the root directory (containing bin/lib folders).
492
492
%%
493
+
%% `.pth' files in the venv's site-packages directory are processed, so
494
+
%% editable installs created by uv, pip, or any PEP 517/660 compliant tool
495
+
%% work correctly. New paths are inserted at the front of sys.path so that
496
+
%% venv packages take priority over system packages.
497
+
%%
493
498
%% Example:
494
499
%% ```
495
500
%% ok = py:activate_venv(<<"/path/to/myenv">>).
@@ -504,12 +509,16 @@ activate_venv(VenvPath) ->
504
509
caseeval(<<"__import__('os').path.isdir(sp)">>, #{sp=>SitePackages}) of
505
510
{ok, true} ->
506
511
%% Save original path if not already saved
507
-
_=eval(<<"setattr(__import__('sys'), '_original_path', __import__('sys').path.copy()) if not hasattr(__import__('sys'), '_original_path') else None">>),
512
+
{ok, _}=eval(<<"setattr(__import__('sys'), '_original_path', __import__('sys').path.copy()) if not hasattr(__import__('sys'), '_original_path') else None">>),
0 commit comments