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

Different dependency versions installed in dev versus final Docker images #792

Closed
glennmatthews opened this issue Aug 9, 2021 · 5 comments · Fixed by #1323 or #1620
Closed

Different dependency versions installed in dev versus final Docker images #792

glennmatthews opened this issue Aug 9, 2021 · 5 comments · Fixed by #1323 or #1620
Assignees
Labels
type: bug Something isn't working as expected

Comments

@glennmatthews
Copy link
Contributor

glennmatthews commented Aug 9, 2021

Environment

  • Python version: any
  • Nautobot version: 1.1.1

Steps to Reproduce

  1. Build and run dev docker image and run pip list
  2. Build and run final docker image and run pip list
  3. Compare outputs

Expected Behavior

Installed packages should be identical except for the additional dev-only dependencies present in the dev image.

Observed Behavior

In several cases final has newer versions of various dependencies than dev, for example:

  • dev has idna 2.10 whereas final has idna 3.2
  • dev has packaging 20.9 whereas final has packaging 21.0
  • dev has requests 2.25.1 whereas final has requests 2.26.0
  • etc.

This is problematic as it means that final and dev may show different behavior, have different bugs or fixes, etc.

The root cause appears to be that the dev image installs its dependencies based on exact versions pinned in poetry.lock, whereas the final image installs its dependencies based on the looser version constraints defined in pyproject.toml.

Related Poetry FR and PR: python-poetry/poetry#2778, python-poetry/poetry#3341

@glennmatthews glennmatthews added type: bug Something isn't working as expected status: accepted labels Aug 9, 2021
@glennmatthews glennmatthews self-assigned this Aug 9, 2021
@glennmatthews
Copy link
Contributor Author

One possibility might be to use https://bneijt.nl/pr/poetry-lock-package/ to build a "locked" wheel and install that one in the final Docker image so as to ensure that it has the same dependencies as the dev image. The potential downside is that this will prevent any consumers of the final image from doing a pip install --upgrade of any dependencies, even for security updates and such, since the dependency versions will be locked.

Another option would be to aggressively ensure that for our release version images, at least, that we are consistently running poetry update prior to release so as to minimize the delta between what's in dev images and what are the latest acceptable versions of our dependencies installed in final images.

@glennmatthews
Copy link
Contributor Author

Related: #1097.

glennmatthews added a commit that referenced this issue Feb 2, 2022
glennmatthews added a commit that referenced this issue Feb 2, 2022
glennmatthews added a commit that referenced this issue Feb 2, 2022
glennmatthews added a commit that referenced this issue Feb 2, 2022
* Revert "Installed locked dependencies in final image as well as dev. Fixes #792 (#1323)"

This reverts commit 26cb2f7.

* Revert "Add release-note for #792 [skip ci]"

This reverts commit d078ace.
@glennmatthews
Copy link
Contributor Author

Reopening as #1323 had to be rolled back by #1325.

@glennmatthews glennmatthews reopened this Feb 2, 2022
@glennmatthews
Copy link
Contributor Author

There seem to be quite a few open issues against Poetry involving incorrect dependency declarations - any or all of these may be causing the issues we encountered with #1323, but dropping support for Python 3.6 (#1268) will at least in the short term allow us to avoid the currently encountered issue as it'll let us remove the split dependencies that we currently have for Python 3.6 versus all later versions, which are causing the current failures. However there is a concern that at some point in the future we may find ourselves in this same position (e.g. with respect to Python 3.7) so getting the issues fixed in Poetry would still be highly desirable.

@glennmatthews
Copy link
Contributor Author

Fixed in next by #1620.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 14, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
type: bug Something isn't working as expected
Projects
No open projects
Archived in project
1 participant