Updating a Poetry Module Installed from a Private git Repo

How to keep your git dependency up to date in a poetry environment.

I’m currently working on a project using poetry for dependency management (v2.0.1), and since I’m developing a few libraries at once, using the ability of poetry to add dependencies from a private git repository [1]. One issue I ran into was that running a simple poetry update git_repo_dep does not seem to fetch the latest version of the dependency from Git, which appears to be an on-again/off-again issue [2, 3, 4], with a workaround seeming to be to uninstall the project entirely, and then reinstall without a cache, or to force the installation using pip from within a poetry shell. For my version of poetry, this still did not appear to work.

What did work was to find the [package.source] section for dependency in question in the poetry.lock file and updating the resolved_reference parameter manually to whatever commit I needed (usually the latest one). After that, a simple poetry install would fetch the latest version.

You can also re-add the project with an explicit commit reference, for example:

$ poetry add git+ssh://git@git.server.com/username/project.git@abcdefg123456789

Though this hems you in and requires that you manually re-add your project with the latest commit every time you want an update, but it’s perhaps a little easier than manually editing poetry.lock.

Previous