Closed Opalo closed 10 months ago
This is expected, as packages can specify different dependencies according to the current platform or Python version. Notice that keyring specifies a bunch of dependencies this way.
Thanks @AndydeCleyre! What is the suggested course of action here then? Should I wrap pip-compile
invocation in some docker container or can handle it differently? I need to have consistent results.
@Opalo it depends on your use-case. If it's an app deployed to a single well-defined environment, you might want to make sure you use the same env to manage the logfiles. If you have a library and test against a matrix of envs, you may opt to have a bunch of constraint files per each combo of Python, OS and arch. The latter would require some wrapper script to select different constraint files in different envs, I'm experimenting with such an approach @ https://github.com/cherrypy/cheroot/tree/main/requirements for quite a while and I like how it allows me to keep the CI green with no surprise transitive dependency bumps and transparent package updates.
Oh, and make sure to study the docs carefully. I think they can provide you with more insight.
Thanks for all the hints! I've wrapped the generation into a docker container. And it all works fine.
Environment Versions
1. OS
macOS
:and:
python:3.9.16-slim
docker image2. Python
macOS
:and:
python:3.9.16-slim
docker image3. PIP
macOS
:and:
python:3.9.16-slim
docker image4. pip-tools
macOS
:and:
python:3.9.16-slim
docker imageSteps to replicate
requirements.in
file:pip-compile -o requirements.txt --strip-extras requirements.in
on both OSesrequirements.txt
Expected result
Both generated
requitements.txt
should contain the same packages and versions.Actual result
For macOS:
For
python:3.9.16-slim
docker image:Diff:
I don't have an idea why the generated files are different but I'd expect them to be the same. The problem started when I added the generated files (on macOS) to source control and it failed in GH action on GH CI. For the very beginning I thought it is related to python and pip versions - when I unified them (3.9.16 vs 3.9.18 for python) some differences disappeared. Then I thought
pre-commit
is to be blamed, finally it turned out that differentrequirements.txt
files are generated even with the same versions of tools being used. The only difference is the OS.