From f203fd58741ec3845a281c7b945ef2e48b57ddb6 Mon Sep 17 00:00:00 2001 From: DarthMooMancer <107283522+DarthMooMancer@users.noreply.github.com> Date: Fri, 14 Mar 2025 11:30:18 -0400 Subject: [PATCH] Update python.lua --- lua/Polydev/python.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lua/Polydev/python.lua b/lua/Polydev/python.lua index a582f63..7556972 100644 --- a/lua/Polydev/python.lua +++ b/lua/Polydev/python.lua @@ -140,8 +140,13 @@ setup( ) ]], project_name)) - vim.fn.system("python3 -m venv " .. project_root .. "/venv") - vim.fn.system("source " .. project_root .. "/venv/bin/activate") + local venv_path = project_root .. "/venv" + vim.fn.system("python3 -m venv " .. venv_path) + vim.g.python3_host_prog = venv_path .. "/bin/python" + vim.fn.setenv("VIRTUAL_ENV", venv_path) + vim.fn.setenv("PATH", venv_path .. "/bin:" .. vim.fn.getenv("PATH")) + + print("Virtual environment activated for " .. project_name) vim.cmd("edit " .. project_root .. "/main.py") end) end @@ -168,7 +173,7 @@ end function M.install_dependency() vim.ui.input({ prompt = "Enter pip module: " }, function(pip_module) - if not pip_module or pip_module == "" then + if not pip_module or pip_module == "" then return print("Pip canceled") end