poetry-plugin-bundle
poetry-plugin-bundle copied to clipboard
bundle dependencies marked as editable
For dependencies marked as editable, this plugin will create .pth files including the local location of the path-based dependency. In that sense, the dependency is not bundled.
Is there a reason for a bundled install to observe the "develop = true" flag? If so, can we have an option to install these packages as non-editable instead? According to my reading of https://github.com/python-poetry/poetry/issues/1382#issuecomment-1266291854, this bundler is supposed to handle that installation case.
poetry 1.2.1
poetry-core 1.2.0
poetry-plugin-bundle 1.1.0
Any updates here? AFAICT this is blocking a poetry-only solution to install path deps in non-editable mode for docker multi-stage builds.
With:
- poetry 1.6.1
- poetry-plugin-bundle 1.3.0
I don't experience the same behaviour. Editable packages are correctly bundled as non editable (ie no .pth is created).
I use the following command (from a Dockerfile): poetry bundle venv --only=main --no-interaction --no-cache /bundle
Edit: my bad ! poetry.lock
was not up-to-date and still contained develop = false
. I can reproduce the issue with above mentioned versions.
I want to add my support behind this. We also want to use this feature for our Docker builds.
@finswimmer, Would it be possible for you to comment if this change can be tackled purely in this package, or does it require changes upstream to poetry itself?
I would be willing to make those changes if it is just scoped to this package. If this requires poetry changes, can we plan the LOE for that?
Any progress? How can we help?
I would be willing to make those changes if it is just scoped to this package. If this requires poetry changes, can we plan the LOE for that?
I assume this requires changes in poetry. This plugin just runs the installer:
https://github.com/python-poetry/poetry-plugin-bundle/blob/3e389b98eb077d92960ab6a0bf43e21b82e8f116/src/poetry_plugin_bundle/bundlers/venv_bundler.py#L133
You probably have to implement an interface to tell the installer to ignore the develop flag. For example, depending on the setting you could iterate over all operations and set develop to false for each package before executing the operations at: https://github.com/python-poetry/poetry/blob/37028af45787af736b50c081589532034642469d/src/poetry/installation/installer.py#L357
@radoering
I have an idea of solution/implementation.
Installer gets 'develop' flag from lock file passed to him. See here: https://github.com/python-poetry/poetry/blob/a74d3a79028535baf48073c969d327978d87d6c9/src/poetry/installation/installer.py#L288
Lock file is generated by Locker. See here: https://github.com/python-poetry/poetry/blob/a74d3a79028535baf48073c969d327978d87d6c9/src/poetry/installation/installer.py#L261
Locker is passed to Installer from this plugin. See here: https://github.com/python-poetry/poetry-plugin-bundle/blob/d2a7d6d08692c58d7797f6f37eda87e8508e0295/src/poetry_plugin_bundle/bundlers/venv_bundler.py#L125
So we can override Locker in plugin code and set develop
flag for all packages to false
. Profit!
@vladkolotvin Not quite obvious at first glance because the plugin only takes a locker and passes it through - it does not create a locker instance. However, creating a locker proxy, which overrides locked_repository
, might work. Feel free to create a PR.