Improve the installation of Poetry
See original GitHub issue- I have searched the issues of this repo and believe that this is not a duplicate.
Issue
It’s common knowledge at this point that using the recommended installer of Poetry can lead to a lot of problems, being permissions issues, different behaviors depending on how Python was installed.
So, before we reach version 1.0
we have to tackle this problem in order to make installing Poetry as painless as possible.
Every proposition made at this point (using pipsi
, using sudo
) are not satisfying enough to make an intuitive experience.
We should keep using a custom installer, in my opinion, and make it more clever.
For that, I think taking an inspiration in what rustup
/Cargo
does would be ideal. Basically we would have the following steps:
- Download the latest stable (or pre-release) version of poetry.
- Download all its dependencies in the
poetry/_vendor
directory. - Copy it and all extra files in
$POETRY_HOME
(~/.poetry/
for UNIX systems and%USERPROFILE%/.poetry/
on Windows). - Updates the PATH automatically in a system-specific way.
The $POETRY_HOME
directory would contain two directories:
lib
which would contain the completepoetry
package.bin
which would contain apoetry
script that could be called from any currently activated Python executable. This directory would be added to the PATH automatically.
This has many advantages:
- Installing in the user directory makes sure that we have write access.
- One single installation of Poetry necessary that can be used by any Python executable.
- Easier for the
self:update
command to work thanks to a single possible location. - The automatic update of the PATH removes the hassle for the end user to do it themselves.
The poetry
script in bin/
could look like this on UNIX systems:
#!/usr/bin/env python
import sys
import os
lib = os.path.realpath(os.path.join(os.path.dirname(__file__), "..", "lib"))
sys.path.insert(0, lib)
if __name__ == "__main__":
from poetry.console import main
main()
Issue Analytics
- State:
- Created 5 years ago
- Reactions:1
- Comments:17 (10 by maintainers)
Top GitHub Comments
It would be nice if we could customize
POETRY_{HOME,BIN}
etc.The suggestion of @Patristo to adhere to the XDG specification would be ideal. As others have mentioned
$HOME/.local/bin
is already in the path of a lot of Linux systems these days (in compliance with systemd). Currently, poetry is one of the only tools polluting my home directory with no easy way to change this behavior. 😛@nackjicholson What’s your thoughts about using
$XDG_CONFIG_HOME
$XDG_DATA_HOME
? (These default to$HOME/.config
$HOME/.local/share
) I’m not too across the XDG spec adoption, but understand pip is now using it for its pip.conf files. https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html