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

Equivalent of pip --force-reinstall #3931

Closed
2 tasks done
zhzhang opened this issue Apr 13, 2021 · 5 comments
Closed
2 tasks done

Equivalent of pip --force-reinstall #3931

zhzhang opened this issue Apr 13, 2021 · 5 comments
Labels
kind/question User questions (candidates for conversion to discussion)

Comments

@zhzhang
Copy link

zhzhang commented Apr 13, 2021

  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have searched the documentation and believe that my question is not covered.

Feature Request

Does poetry have (or have a roadmap for) the --force-reinstall feature in pip?
My use case is iterating on a library locally, and reinstalling it frequently to test my changes in a separate poetry project that contains a client application that's using the library I'm developing.
The current process of remove and install removes and reinstalls the dependencies, which takes a long time. It would be better to have a --force-reinstall flag like in pip that just installs the contents of the library without touching the dependencies.

@zhzhang zhzhang added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Apr 13, 2021
@abn
Copy link
Member

abn commented Apr 13, 2021

I don't think this is required. poetry install will, by default, "reinstall" the root project. And note that the project is installed as an editable install. This means, the only scenario where you might need to reinstall is in cases where console scripts for the project have changed, metadata for the project has changed and/or new paths were added to the project (root packages).

@abn abn added kind/question User questions (candidates for conversion to discussion) and removed kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Apr 13, 2021
@zhzhang
Copy link
Author

zhzhang commented Apr 13, 2021

I'm finding that that's not the case as far as my usage goes. My steps are:

  • add a print statement in mylibrary.mymodule.main
  • run poetry update ../../mylibrary from a test project. This prints No dependencies to install or update
  • run poetry run python -m mylibrary.mymodule.main. This does not print the new message.
  • Go to mylibrary and upgrade the patch version by 1.
  • run poetry update ../../mylibrary from a test project. This prints Package operations: 0 installs, 1 update, 0 removals
  • run poetry run python -m mylibrary.mymodule.main. This does print the new message.

So this suggests to me that unless the version number changes, the root project is not reinstalled. Upgrading my patch version to force reinstalls during dev is not a terrible state to be in, but it does add an extra step (and an extra source of error if I forget to drop the patch version counter back down before deploying) to my process.

@abn
Copy link
Member

abn commented Apr 13, 2021

@zhzhang Seems you are instaling a local path dependency. My statement was regarding the root project, ie. the current project managed by poetry.

In your case, you can install the local library path as an editable dependency, ie. { ...., develop = true }.

@zhzhang
Copy link
Author

zhzhang commented Apr 13, 2021

Nice! Thanks for the pointer! Only suggestion is to maybe add a flag for develop or editable under the poetry add command. Will close the issue.

Copy link

github-actions bot commented Mar 2, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/question User questions (candidates for conversion to discussion)
Projects
None yet
Development

No branches or pull requests

2 participants