I'm learning more each day about :pants: :smile: S...
# general
b
I'm learning more each day about 👖 😄 Some parts, I miss (probably because I'm not aware of how to properly solve it with pants) and have done a shell-hack to have the Developer Code Editor experience I'm used to. I know that PyCharm has features for setting source paths and such, but I use Emacs and like the convention of a
.venv
folder, and the source paths added with
.pth
files. So I came up with this hack (in thread):
Copy code
#!/usr/bin/env bash
pants export

PANTS_VENV_PATH="./dist/export/python/virtualenvs/python-default"
PTH_FILE_NAME="local-dev-extra.pth"
VENV_SITE_PACKAGES=$(find $PANTS_VENV_PATH -name site-packages)
ROOTS=($(pants roots))

# create a .pth file with the root absolute paths
echo "$(pwd)" > "$VENV_SITE_PACKAGES/$PTH_FILE_NAME"

for root in $ROOTS
do
  echo "$(pwd)/$root" >> "$VENV_SITE_PACKAGES/$PTH_FILE_NAME"
done

# Create a .venv symlink
PYTHON_VERSION=$(python --version | sed 's/Python //g')
ln -s $PANTS_VENV_PATH/$PYTHON_VERSION ./.venv
👀 1