Skip to content

Improve the installation of Poetry #342

@sdispater

Description

@sdispater
  • 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()

Metadata

Metadata

Assignees

Labels

area/installerRelated to the dependency installerkind/featureFeature requests/implementations

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions