Use poetry to manage virtualenvs
This commit is contained in:
parent
b4bf1d5c6d
commit
fcb9cc02f9
5 changed files with 22 additions and 28 deletions
|
|
@ -138,25 +138,15 @@
|
|||
("C-c C-p" . flycheck-previous-error)
|
||||
("C-c C-l" . flycheck-list-errors)))
|
||||
|
||||
(use-package pyvenv)
|
||||
|
||||
(defun find-venv ()
|
||||
"Try to find a .venv/ directory in the current project"
|
||||
(require 'f)
|
||||
(let ((basedir (f-traverse-upwards
|
||||
(lambda (path)
|
||||
(let ((venv-path (f-expand ".venv" path)))
|
||||
(f-exists? venv-path))))))
|
||||
(when basedir (f-expand ".venv" basedir))))
|
||||
; Requires poetry to be installed
|
||||
(use-package poetry)
|
||||
|
||||
(defun load-python-env ()
|
||||
"Set up the Python IDE in the current project"
|
||||
(interactive)
|
||||
(let ((venv-dir (find-venv)))
|
||||
(when venv-dir
|
||||
(progn
|
||||
(pyvenv-activate venv-dir)
|
||||
(lsp)))))
|
||||
(progn
|
||||
(poetry-venv-workon)
|
||||
(lsp)))
|
||||
|
||||
(defun symbols-at-point ()
|
||||
(let* ((lsp--document-symbols-request-async t)
|
||||
|
|
|
|||
|
|
@ -21,7 +21,6 @@ network-manager \
|
|||
pipx \
|
||||
postfix \
|
||||
pulseaudio-utils \
|
||||
python3-venv
|
||||
sway \
|
||||
swayidle \
|
||||
swaylock \
|
||||
|
|
@ -32,8 +31,12 @@ xournalpp \
|
|||
"
|
||||
|
||||
PIPX_PKGS="\
|
||||
poetry \
|
||||
yt-dlp \
|
||||
"
|
||||
|
||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes ${DEB_PKGS}
|
||||
pipx install ${PIPX_PKGS}
|
||||
for pkg in ${PIPX_PKGS};
|
||||
do
|
||||
pipx install "${pkg}"
|
||||
done
|
||||
|
|
|
|||
11
.local/bin/init-venv
Executable file
11
.local/bin/init-venv
Executable file
|
|
@ -0,0 +1,11 @@
|
|||
#! /usr/bin/sh
|
||||
|
||||
poetry add \
|
||||
--group dev \
|
||||
black \
|
||||
isort \
|
||||
'python-lsp-server[rope]' \
|
||||
ruff-lsp
|
||||
poetry add \
|
||||
--group test \
|
||||
coverage
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
#! /usr/bin/sh
|
||||
|
||||
python3 -m venv .venv
|
||||
. .venv/bin/activate
|
||||
pip install \
|
||||
black \
|
||||
coverage \
|
||||
isort \
|
||||
'python-lsp-server[rope]' \
|
||||
ruff-lsp
|
||||
pip install -e .
|
||||
1
.profile
1
.profile
|
|
@ -32,4 +32,5 @@ export QT_IM_MODULE="fcitx"
|
|||
export XMODIFIERS="@im=fcitx"
|
||||
export BORG_REPO="/media/backup/"
|
||||
export BORG_PASSCOMMAND="cat ${HOME}/.keys/borg-passphrase.txt"
|
||||
export PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring"
|
||||
. "$HOME/.cargo/env"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue