add python variant

This commit is contained in:
Dietrich Rink
2023-06-10 15:25:00 +02:00
parent bd11cd4ed2
commit b3216433c4
3 changed files with 34 additions and 0 deletions

16
python/Containerfile Normal file
View File

@@ -0,0 +1,16 @@
FROM code-basic
USER root
ENV HOME=/root
# Install alpine packages
RUN apk add --no-cache python3 python3-doc py3-pip py3-pip-doc
# Install pip packages
RUN pip install --no-cache-dir python-lsp-server
# Add neovim config
COPY nvim /etc/xdg/nvim
# Configure environment
USER 1000:1000
ENV HOME=/tmp

View File

@@ -0,0 +1,13 @@
local lspconfig = require('lspconfig')
-- Get python executable from env
local python = vim.fn.globpath(vim.fn.getcwd(), "env/bin/python")
-- Set configuration
local config = {}
if python ~= '' then
config.cmd = { python, '-m', 'pylsp' }
end
-- Set up pylsp
lspconfig.pylsp.setup(config)

View File

@@ -0,0 +1,5 @@
snippet #!
#!/usr/bin/env python3
snippet def
def ${1:name}(${2}):
${0}