Skip to content

Modified build process to use a built wheel instead of poetry#45

Merged
colindean merged 5 commits intomainfrom
nl
Mar 6, 2026
Merged

Modified build process to use a built wheel instead of poetry#45
colindean merged 5 commits intomainfrom
nl

Conversation

@banginji
Copy link
Collaborator

@banginji banginji commented Feb 26, 2026

The Docker image is built as a multi-stage build:

  • Build stage uses Poetry plus poetry-plugin-export to:
    • export runtime dependencies from poetry.lock to requirements.txt
    • build a wheel for this project
  • Runtime stage installs using pip from:
    • exported requirements.txt
    • built wheel

This keeps Poetry out of the runtime/install path while retaining lockfile-pinned dependency resolution.

Fixes #40

Signed-off-by: banginji <ban.ginji@gmail.com>
@banginji banginji requested a review from colindean February 26, 2026 01:48
Dockerfile Outdated

RUN pip install --upgrade pip
RUN pip install --no-cache-dir poetry==2.3.2 poetry-plugin-export==1.9.0
COPY pyproject.toml poetry.lock README.md /build/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion (blocking): Where's this build directory coming from? There's not one in context.

Suggested change
COPY pyproject.toml poetry.lock README.md /build/
COPY pyproject.toml poetry.lock README.md

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reverted to using src folder

Comment on lines -2 to -6
if [[ -n "${INPUT_POETRY_VERSION}" ]]; then
echo "Poetry version set to [${INPUT_POETRY_VERSION}], overriding default version"
pip install --force-reinstall poetry=="${INPUT_POETRY_VERSION}"
fi
poetry --directory /src run python3 -m diff_poetry_lock.run_poetry
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: I don't think we should get rid of this. I can think of a potential use case where someone might want to use an older version of Poetry for some reason. We might not be able to go super old though, and couldn't really guarantee anything but latest.

Copy link
Collaborator Author

@banginji banginji Mar 6, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added back the runtime configurable poetry version

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Something to note though. When I was testing locally, since the run_poetry.py file does import from poetry, I was seeing some issues with when there was a mismatch between runtime poetry version and the build wheels' poetry version and if the method signature changed between them the tool failed to run

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's concerning. How, uh, far apart were the versions? I'd expect that kind of problem between 1.x and 2.x but hopefully not in e.g., 2.2.x and 2.3.x.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah it was between 1.8.5 and 2.3.2

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, I added that warning/disclaimer and we'll go from there. Maybe folks will think it through before they go too old, and if we get some bug reports wanting older versions of Poetry, we can figure something out.

banginji added 2 commits March 6, 2026 09:16
1- Added back the capability to allow users specify the runtime poetry version
2- Reverted the use of src folder instead of build in Dockerfile

Signed-off-by: banginji <7316646+banginji@users.noreply.github.com>
Comment on lines 4 to +7

RUN pip install poetry==2.3.2 && mkdir /src
COPY poetry.lock pyproject.toml README.md entrypoint.sh /src
RUN pip install --upgrade pip
RUN pip install --no-cache-dir poetry==2.3.2 poetry-plugin-export==1.9.0
COPY pyproject.toml poetry.lock README.md /src/
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thought: It just dawned on me why you'd used build here. It was fine after all. My bad. I'll blame it on my not having had enough ☕ lifeblood yesterday when I looked at this 👼

Let's leave it src for now, no need to revert it.

pip install --force-reinstall poetry=="${INPUT_POETRY_VERSION}"
set -euo pipefail

if [[ -n "${INPUT_POETRY_VERSION:-}" ]]; then
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

praise: This is a good idea, and good information for the user.

Copy link
Collaborator

@colindean colindean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is looking great! Thanks. Address the last couple comments and this is good to ship.

Signed-off-by: Colin Dean <colindean@users.noreply.github.com>
@colindean colindean merged commit 5c4ab21 into main Mar 6, 2026
8 checks passed
@colindean colindean deleted the nl branch March 6, 2026 17:16
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 this pull request may close these issues.

Install diff-poetry-lock as a package

2 participants