Poetry: Bundle command

Created on 7 Feb 2020  路  4Comments  路  Source: python-poetry/poetry

As suggested in https://github.com/python-poetry/poetry/issues/537, the addition of a bundle command could prove useful.

There are two cases that we've seen pop up here: the ability to bundle the project and its dependencies in an arbitrary virtual environment and the ability to download the distributions to a specific directory. The former should be implemented directly into Poetry since generating a complete virtual environment makes sense to deploy a Poetry-managed project and the latter could be implemented in a plugin since it's a less common case.

Implementation

Basically the bundle command will be a top-level command (similar to env) which will expose various sub commands.

Initially, only the venv sub command will be available:

poetry bundle venv my-venv/

If the virtual environment directory already exists it will be removed and regenerated.

Specifying a Python version to use to generate the virtual environment will also be possible:

poetry bundle venv my-venv/ --python 3.8
poetry bundle venv my-venv/ --python python3.8
poetry bundle venv my-venv/ --python /usr/local/bin/python3

Extensibility

The bundle command should be extensible so that new sub commands can be added with the use of plugins. This means that this feature depends on the implementation of the plugin system (which is in progress, see #1237)

CLI Feature Plugins Virtualenvs

Most helpful comment

@zdog234 No PR yet but a WIP branch : https://github.com/python-poetry/poetry/tree/bundle-command

Only tests are missing but the feature is almost ready.

All 4 comments

something that came up in the context of #537 and something i've been interested in is the ability to publish packages to pypi that are fully frozen (ie incorporating lockfile deps into the upload), but keep the dev dependency set a bit more loose (per pyproject.toml). the issue we've found is semver isn't universal adhered to, and i've realized that many of our project's older pypi releases from an even a year ago aren't even installable by users due to dep graph version drift even with semver pins.

unfortunately its not clear if thats really the intent with bundle, i'm a little unclear on the use case w/ the current description, ie. how is bundle differentiated to install command. afaict download / extract use case is a bit more common, because its a useful cache artifact for offline install or particular serverless environments, but virtualenvs aren't easily relocatable/portable per se so what does bundle achieve?.

Is there a PR in progress for this? I'm going to have a forced staycation next week, so if I have any time left after installing ethernet, I'd love to spend some time getting the ball rolling on this

@zdog234 No PR yet but a WIP branch : https://github.com/python-poetry/poetry/tree/bundle-command

Only tests are missing but the feature is almost ready.

Any updates on this? The WIP branch seems to have gone a bit quiet. This would be super useful for a bunch of projects I鈥檓 involved in.

Was this page helpful?
0 / 5 - 0 ratings