PYTHON: added venv creation

This commit is contained in:
2026-10-20 17:42:25 -04:00
parent 0f542d56ef
commit 57e8eb0248
4 changed files with 53 additions and 160 deletions
+18 -20
View File
@@ -2,33 +2,31 @@ local M = {}
M.create_project = function(opts)
opts = opts or {}
vim.ui.input({
prompt = "Project language (e.g. python): ",
default = "",
completion = "filetype",
}, function(ft)
ft = ft and vim.trim(ft)
if not ft or vim.trim(ft) == "" then
return
vim.ui.input(
{ prompt = "Project language (e.g. python): ", completion = "filetype" },
function(ft)
ft = ft and vim.trim(ft)
if not ft or vim.trim(ft) == "" then
return
end
local ok, actions = pcall(require, "vern.actions." .. ft)
local configs = require("vern.configs." .. ft)
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
if ok and actions and type(actions.create_project) == "function" then
actions.create_project(args)
else
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
title = "Vern Project",
})
end
end
local ok, actions = pcall(require, "vern.actions." .. ft)
local configs = require("vern.configs." .. ft)
local args = vim.tbl_deep_extend("force", {}, configs, opts or {})
if ok and actions and type(actions.create_project) == "function" then
actions.create_project(args)
else
vim.notify("Unknown Filetype: " .. ft, vim.log.levels.WARN, {
title = "Vern Project",
})
end
end)
)
end
M.create_file = function(opts)
opts = opts or {}
vim.ui.input({
prompt = "File language (e.g. python): ",
default = "",
completion = "filetype",
}, function(ft)
ft = ft and vim.trim(ft)
+3
View File
@@ -33,6 +33,9 @@ function M.create_project(opts)
dump("spec", "pyproject.toml", "pyproject")
utils.init_git(root, "python")
local venv_path = root .. "/venv"
vim.fn.system("python3 -m venv " .. venv_path)
vim.cmd.edit(vim.fn.fnameescape(bin))
end)
end