Last active
April 14, 2023 18:52
-
-
Save pwwang/6b01ce7942d80ea619a524711600b0a7 to your computer and use it in GitHub Desktop.
Install local python package in editable mode managed by poetry
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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