question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Mechanism to reinstall (editable) dependencies to trigger metadata re-build

See original GitHub issue
  • Poetry version: 1.2.1
  • Python version: 3.8.10
  • OS version and name: Ubuntu 21.04
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

When developing a project distributed over many repos that is connected by entrypoint plugins, consider that repo B depends on repo A, and thus contains:

repo-a = { path = "../repo-a/", develop = true }

Sometimes I need to change some entrypoints in repo-a.

For poetry to pick up the changes, I run poetry update repo-a (of course it can’t otherwise know).

Unfortunately, it won’t update entrypoints, so repo-b still sees the old ones (according to importlib_metadata, which I use to collect them).

The only workaround I know of is to:

  • comment out the dependency
  • run poetry update
  • comment in the dependency
  • run poetry update

Which causes a lot of useless package removal and re-installations, but in the end repo-a is registered correctly.

I am not sure whether this should be a feature request or a bug, but chose bug because to me this is “unexpected behavior”.

I expect poetry to pick up these changes for local dependencies when I ask to update, even if nothing else about the dependency changed. The fact that it is “blind” to them violates the purpose of having a local dependency (with develop = True) - making it as painless as possible to simultaneously work on multiple related repositories.

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
apirogovcommented, Sep 27, 2022

Thanks for the quick response!

Yes, I totally agree and this is what I meant. I do not expect that poetry checks the metadata when calling poetry install / update without listing packages or providing any flags. I was just thinking about it purely from the “local dependency angle”, which was maybe not the best way, because it would need to treat different dependency “types” differently.

I totally agree with your reformulation of the issue as a request for a --reinstall flag.

  • it should work with or without any restrictions such as --only
  • it should force-reinstall (a subset of) the immediate deps listed in the pyproject.toml of the project
  • it should not reinstall transitive dependencies (but install/update them normally, if they are missing / outdated)

Given that, I could simply use poetry install --reinstall and it would reinstall all immediate dependencies, or if they are too many, I could separate the ones where this is needed into a group and single them out with --only, if needed - as you suggested.

Or it could be added as a flag to poetry update, which does already accept package names as arguments, so that I could use poetry update --reinstall PACKAGENAME(S), but maybe that is a bit “strange”. In this case it would mean “update my dependencies, and even if they are up to date, reinstall the packages”. I would actually prefer this over needing the --only group because install does not take packages as arguments.

Unfortunately I don’t think that I can properly add that feature myself, at least not in the spare time that I could invest into it 😦

1reaction
neersightedcommented, Oct 2, 2022

Looks like we’ve actually got a FR for this already at https://github.com/python-poetry/poetry/issues/5183.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Development Mode (a.k.a. “Editable Installs”) - Setuptools
Adding new dependencies, entry-points or changing your project's metadata require a fresh “editable” re-installation. Console scripts and GUI scripts MUST be ...
Read more >
Help testing PEP 660 support in setuptools - Packaging
Adding new dependencies, entry-points or changing your project's metadata require a fresh “editable” re-installation.
Read more >
Basic usage | Documentation | Poetry - Python dependency ...
Updating dependencies to their latest versions​​ To update to the latest versions, use the update command. This will fetch the latest matching versions...
Read more >
Locking dependency versions - Gradle User Manual
Run gradle dependencies --write-locks . This will effectively lock all resolvable configurations that have locking enabled. Note that in a multi project setup, ......
Read more >
How to reinstall a pip package even if it exists - Stack Overflow
pip install -r requirements.txt --upgrade --force-reinstall ... With --force-reinstall , existing packages (and dependencies) are ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found