Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bundle dependencies marked as editable #37

Closed
smcoll opened this issue Nov 9, 2022 · 7 comments · Fixed by #106
Closed

bundle dependencies marked as editable #37

smcoll opened this issue Nov 9, 2022 · 7 comments · Fixed by #106

Comments

@smcoll
Copy link

smcoll commented Nov 9, 2022

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 python-poetry/poetry#1382 (comment), this bundler is supposed to handle that installation case.

poetry 1.2.1
poetry-core 1.2.0
poetry-plugin-bundle 1.1.0

@micahjsmith
Copy link

Any updates here? AFAICT this is blocking a poetry-only solution to install path deps in non-editable mode for docker multi-stage builds.

@graham2071
Copy link

graham2071 commented Sep 14, 2023

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.

@TNonet
Copy link

TNonet commented Nov 15, 2023

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?

@caeus
Copy link

caeus commented Feb 23, 2024

Any progress? How can we help?

@radoering
Copy link
Member

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:

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

@vladkolotvin
Copy link
Contributor

vladkolotvin commented Jul 20, 2024

@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:

So we can override Locker in plugin code and set develop flag for all packages to false. Profit!

@radoering
Copy link
Member

@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.

vladkolotvin added a commit to vladkolotvin/poetry-plugin-bundle that referenced this issue Jul 21, 2024
radoering pushed a commit to vladkolotvin/poetry-plugin-bundle that referenced this issue Jul 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants