Replies: 1 comment
-
There is always one version for a specific environment. There can be multiple versions, each for a different environment.
No ranges, always exact versions (with a list of sdists/wheels including hashes). If there are multiple versions for the same package, then they are for different environments.
No, there can be different versions for everything that can be expressed via an environment marker, e.g. different versions for Linux and Windows via
As far as I know it is the same as
It is not guaranteed. Poetry does not check wheel availability. If there is no wheel for a specific environment and the package does not provide an sdist, creating the environment will fail. The only guarantee is that if installing once from a lock file in a specific environment (Python version, OS, ...) succeeds, then you will get the same result for the same environment later. |
Beta Was this translation helpful? Give feedback.
-
Hello :) I'm fairly new to poetry, and was wondering how poetry.lock exactly works.
1) Does it specify the exact package version?
The official document says that poetry.lock will ensure that everyone will get the same versions of the dependencies.
However, I ran into previous discussions on how poetry.lock sometimes include multiple versions of a package.
multiple package versions locked
My questions are,
1-1). Does poetry.lock always specify one version (that is installed in the current poetry project) of each package?
Are there cases where a range instead of exact one version is written,
or there are multiple versions?
I checked https://github.com/orgs/python-poetry/discussions/10258#discussion-8048361, where there could be different package versions stated for different python versions. Is this the only case?
1-2). If the answer to 1-1) is NO, then how can poetry.lock be used to create the exact same environment? For instance, is it different from conda list or uv.lock?
2) Is building environment with the file guaranteed for different platforms?
I understand that poetry can be used in multiple platforms (MacOS, Linux, Windows, etc.) Does a poetry.lock file guarantee building the same environment for different platforms as well? or could there be caveats like packages not supported in certain platforms?
Thank you so so much for your interest in this topic and your responses!
Beta Was this translation helpful? Give feedback.
All reactions