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-p" . flycheck-previous-error)
|
||||||
("C-c C-l" . flycheck-list-errors)))
|
("C-c C-l" . flycheck-list-errors)))
|
||||||
|
|
||||||
(use-package pyvenv)
|
; Requires poetry to be installed
|
||||||
|
(use-package poetry)
|
||||||
(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))))
|
|
||||||
|
|
||||||
(defun load-python-env ()
|
(defun load-python-env ()
|
||||||
"Set up the Python IDE in the current project"
|
"Set up the Python IDE in the current project"
|
||||||
(interactive)
|
(interactive)
|
||||||
(let ((venv-dir (find-venv)))
|
(progn
|
||||||
(when venv-dir
|
(poetry-venv-workon)
|
||||||
(progn
|
(lsp)))
|
||||||
(pyvenv-activate venv-dir)
|
|
||||||
(lsp)))))
|
|
||||||
|
|
||||||
(defun symbols-at-point ()
|
(defun symbols-at-point ()
|
||||||
(let* ((lsp--document-symbols-request-async t)
|
(let* ((lsp--document-symbols-request-async t)
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ network-manager \
|
||||||
pipx \
|
pipx \
|
||||||
postfix \
|
postfix \
|
||||||
pulseaudio-utils \
|
pulseaudio-utils \
|
||||||
python3-venv
|
|
||||||
sway \
|
sway \
|
||||||
swayidle \
|
swayidle \
|
||||||
swaylock \
|
swaylock \
|
||||||
|
|
@ -32,8 +31,12 @@ xournalpp \
|
||||||
"
|
"
|
||||||
|
|
||||||
PIPX_PKGS="\
|
PIPX_PKGS="\
|
||||||
|
poetry \
|
||||||
yt-dlp \
|
yt-dlp \
|
||||||
"
|
"
|
||||||
|
|
||||||
sudo DEBIAN_FRONTEND=noninteractive apt-get install --yes ${DEB_PKGS}
|
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 XMODIFIERS="@im=fcitx"
|
||||||
export BORG_REPO="/media/backup/"
|
export BORG_REPO="/media/backup/"
|
||||||
export BORG_PASSCOMMAND="cat ${HOME}/.keys/borg-passphrase.txt"
|
export BORG_PASSCOMMAND="cat ${HOME}/.keys/borg-passphrase.txt"
|
||||||
|
export PYTHON_KEYRING_BACKEND="keyring.backends.null.Keyring"
|
||||||
. "$HOME/.cargo/env"
|
. "$HOME/.cargo/env"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue