question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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 complete poetry package.
  • bin which would contain a poetry 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:closed
  • Created 5 years ago
  • Reactions:1
  • Comments:17 (10 by maintainers)

github_iconTop GitHub Comments

11reactions
JesseFarebrocommented, Dec 3, 2018

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. 😛

9reactions
Patristocommented, Oct 16, 2018

@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

Read more comments on GitHub >

github_iconTop Results From Across the Web

Commands | Documentation | Poetry - Python dependency ...
The install command reads the pyproject. toml file from the current project, resolves the dependencies, and installs them. If there is a poetry....
Read more >
How To Install Poetry to Manage Python Dependencies on ...
Poetry is installed using an official installation script provided on the Poetry website. This command will download the installation script, ...
Read more >
Poetry has officially fixed / permanently included pip install -e
Poetry itself supports editable installs already a long time: The project you are working on is install as editable by default on a...
Read more >
A Poetic Apology. Or Why Should You Use Poetry to Manage…
pip install -r requirements.txt. Just as you are about to reveal your masterpiece project to the world, you become aware that the improved...
Read more >
Dependency Management With Python Poetry
After an update, a package might not work as it did before the update. A dependency manager like Python Poetry helps you specify,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found