Page MenuHomePhabricator

Add pipenv or poetry support for webservice-python-bootstrap script
Open, Needs TriagePublic0 Estimated Story Points

Description

If a Pipenv.lock file is in the root, then the script should use the locked dependencies instead of requirements.txt. In theory this will make for safer/more predictable deploys.

Or we support pyproject.toml if it's set up for poetry usage.

Event Timeline

My understanding is that pipenv is kind of dead now, and most of the focus and development has shifted towards poetry. However, poetry isn't yet packaged for our Debian versions, which means we'd have to figure out some way to install it safely before we can support this.

Legoktm renamed this task from Add pipenv support for webservice-python-bootstrap script to Add pipenv or poetry support for webservice-python-bootstrap script.Jan 24 2020, 6:31 AM
Legoktm updated the task description. (Show Details)

Agreed on Poetry over Pipenv at this point.

Might something like PEP 517 builds be useful here? You can pip install a directory containing a pyproject.toml, and pip will then install the specified backend and delegate the rest of the build to that backend. This ends up installing the package into the virtual environment, but that shouldn't usually be a problem.

Alternately, something like micropipenv would be an easy way to support Poetry. It can be safely installed into a virtual environment with pip, as it has only one external dependency (toml). Installing Poetry into a virtual environment isn't a great idea because it brings in a lot of dependencies that could conflict with the project. Micropipenv does not do dependency resolution though, it just installs whatever the poetry.lock file tells it to do.

Agreed on Poetry over Pipenv at this point.

Might something like PEP 517 builds be useful here? You can pip install a directory containing a pyproject.toml, and pip will then install the specified backend and delegate the rest of the build to that backend. This ends up installing the package into the virtual environment, but that shouldn't usually be a problem.

I'm not fully up to speed on PEP 0517, but that sounds like a good idea to me, especially if we only need pip to be installed.

Alternately, something like micropipenv would be an easy way to support Poetry. It can be safely installed into a virtual environment with pip, as it has only one external dependency (toml). Installing Poetry into a virtual environment isn't a great idea because it brings in a lot of dependencies that could conflict with the project. Micropipenv does not do dependency resolution though, it just installs whatever the poetry.lock file tells it to do.

If that doesn't work out, this looks appealing just because it's a single file that we can copy into the container pretty cheaply.

pipenv is supported with the build service python buildpack (https://wikitech.wikimedia.org/wiki/Help:Toolforge/Build_Service#Supported_languages and https://github.com/heroku/heroku-buildpack-python), poetry is not yet though, for poetry you'll have to run 'poetry export' or similar to generate the requirements.txt file beforehand.