Files
vern-nvim/lua/vern/templates/python/init.lua
T
DarthMooMancer 98bd619cfa REFACTOR: Merged templates into a per language file, deleted init.lua as
it was just a middle man and wasnt needed (in fact it is better without
it)
FT: Changes to python
2026-10-15 23:32:26 -04:00

54 lines
890 B
Lua

local M = {}
M.main = function(opts)
local template = [=[
def main() -> None:
printf("Hello from %s!")
if __name__ == "__main__":
main()
]=]
return string.format(template, opts.project_name)
end
M.__init__ = function(opts)
local template = [=[
# %s
__all__: list[str] = []
]=]
return string.format(template, opts.project_name)
end
M.pyproject = function(opts)
local n = opts.project_name
local template = [=[
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "%s"
version = "0.1.0"
description = "Project %s"
readme = "README.md"
requires-python = ">=3.10"
dependencies = []
[project.scripts]
%s = "%s.main:main"
]=]
return string.format(template, n, n, n, n)
end
M.module = function(opts)
local template = [=[
"""
%s module
"""
]=]
return string.format(template, opts.project_name)
end
return M