Is it possible to detect and preserve packages from base virtual environment in multi-stage Docker builds? #10512
Replies: 2 comments 6 replies
-
poetry only knows or cares about packages in its lockfile if you are claiming that locked packages are incompatible, that would be a bug (but in that case you likely are mistaken about what is happening) if you mean that poetry will happily install things that clash with something about which it knows nothing - that's correct. It's up to you to manage those other things. If you want poetry to care about them, say so in your pyproject.toml. |
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Question: Is it possible for Poetry to validate existing virtual environment packages?
Context
I'm using Docker multi-stage builds where a base image contains a Poetry-managed virtual environment, and derived images need to add dependencies while reusing the base environment.
Current Behavior
When
poetry install
runs in a derived container:pyproject.toml
pip check
afterwards reveals actual dependency conflicts that Poetry didn't catchSpecific Example
Base Image: Virtual environment with Package A == 2.0
Derived Image:
pyproject.toml
specifies Package A == 1.5Result: Poetry installs successfully but
pip check
shows conflictsCore Questions
1. Is it currently possible for Poetry to:
2. Is this scenario supported by Poetry's current design, or is it considered outside the intended use case?
3. Are there built-in Poetry commands or flags that can perform this validation?
4. Should Poetry be expected to catch these incompatibilities that
pip check
detects?Why This Matters
This pattern is increasingly common in:
Environment
Bottom line: Is Poetry capable of this validation, or should I be using different tools/approaches for this use case?
Beta Was this translation helpful? Give feedback.
All reactions