Skip to content

Instantly share code, notes, and snippets.

@pwwang
Last active April 14, 2023 18:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwwang/6b01ce7942d80ea619a524711600b0a7 to your computer and use it in GitHub Desktop.
Save pwwang/6b01ce7942d80ea619a524711600b0a7 to your computer and use it in GitHub Desktop.
Install local python package in editable mode managed by poetry
function poetry-editable --description 'Do editable install for poetry project'
echo "= RUN poetry build"
poetry build
set ver (poetry version -s)
pushd dist/
tar zxvf *-$ver.tar.gz
popd
mv setup.py setup.py.bak
function on_premature_exit
functions -e on_premature_exit
echo "= RESTORE setup.py"
mv setup.py.bak setup.py
end
echo "= PREPARE setup.py"
ln -s dist/*-$ver/setup.py
if test $status -ne 0
on_premature_exit
return 1
end
echo "= RUN pip install"
python setup.py develop 2> /tmp/pip-editable
if test $status -ne 0
on_premature_exit
echo " FAILED. Check full log at /tmp/pip-editable"
tail /tmp/pip-editable
return 1
end
on_premature_exit
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment