Poetry: Support customizable POETRY_HOME

Created on 4 Jan 2019  路  4Comments  路  Source: python-poetry/poetry

It would be nice to define where poetry gets installed (via get-poetry.py).

By reading the docstring I had assumed it would work in $POETRY_HOME, but that was quickly disproven.

Ideally this could be defined via an environment variable (POETRY_HOME) or via a flag to get-poetry.py.

Feature

Most helpful comment

My preferred option for workaround (in case someone drops by here, who cannot wait for #794 to be merged)

given you already have get-poetry.py somewhere... and given sed is OK (this one should work fine on most Linux and Macs)

export get_poetry="/path/to/get/poetry"
python <( sed 's/^POETRY_HOME.*=.*/POETRY_HOME = os.environ.get("POETRY_HOME") or os.path.join(HOME, ".poetry")/' "$poetry_installer" )

Note you could of course do manual equivalent (editing by hand). or you could do a hack of temporarily overriding HOME. I am partial to the sed way above because it seems fairly compatible, and doesn't involve hidden knowledge of a manual (or one-time-then-committed) patch to the file.

All 4 comments

Aside, this is to make things like Travis and Docker easier to configure without a lot of custom code in each. Example of me continually guessing and messing this up is available here:

https://github.com/getsentry/zeus/pull/166

Hopefully by the time you've read this I have it all functional ;)

Yes, please. I need to run my docker app as non-root, while all packages are installed as root. Poetry is getting installed in /root/.poetry and then a non-root user can't use it.

My preferred option for workaround (in case someone drops by here, who cannot wait for #794 to be merged)

given you already have get-poetry.py somewhere... and given sed is OK (this one should work fine on most Linux and Macs)

export get_poetry="/path/to/get/poetry"
python <( sed 's/^POETRY_HOME.*=.*/POETRY_HOME = os.environ.get("POETRY_HOME") or os.path.join(HOME, ".poetry")/' "$poetry_installer" )

Note you could of course do manual equivalent (editing by hand). or you could do a hack of temporarily overriding HOME. I am partial to the sed way above because it seems fairly compatible, and doesn't involve hidden knowledge of a manual (or one-time-then-committed) patch to the file.

794 closes this issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jhrmnn picture jhrmnn  路  3Comments

alexlatchford picture alexlatchford  路  3Comments

etijskens picture etijskens  路  3Comments

Euphorbium picture Euphorbium  路  3Comments

AWegnerGitHub picture AWegnerGitHub  路  3Comments