matrix-org / setup-python-poetry

Like snok/install-poetry, but with caching built in.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Caching of poetry-managed packages seems not to work with Poetry 1.2

DMRobertson opened this issue · comments

E.g. from a poetry 1.1.12 run here: https://gist.github.com/DMRobertson/78fbc63f0c3dd095fd7a4f32c4d6c74e

2022-08-31T12:11:36.5011632Z ##[group]Run poetry install --no-interaction --extras="all"
2022-08-31T12:11:36.5012365Z �[36;1mpoetry install --no-interaction --extras="all"�[0m
2022-08-31T12:11:36.5075969Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-08-31T12:11:36.5076262Z env:
2022-08-31T12:11:36.5076556Z   pythonLocation: /opt/hostedtoolcache/Python/3.10.6/x64
2022-08-31T12:11:36.5076926Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.6/x64/lib
2022-08-31T12:11:36.5077216Z ##[endgroup]
2022-08-31T12:11:52.6334127Z Installing dependencies from lock file
2022-08-31T12:12:10.3683392Z 
2022-08-31T12:12:10.3684457Z No dependencies to install or update
2022-08-31T12:12:10.4119921Z 
2022-08-31T12:12:10.4122449Z Installing the current project: matrix-synapse (1.66.0rc2)
2022-08-31T12:12:14.7532260Z ##[group]Run poetry env info

It seems to take 16 seconds to print "Installing dependencies from lock file", then 18 to print "No dependencies to install or update". Installing the current project takes 4 seconds.

On a recent poetry 1.2 run here https://gist.github.com/DMRobertson/f9c4a84e0b66e93f59bfdf69ac1da66f

2022-09-01T11:52:11.8234377Z ##[group]Run poetry install --no-interaction --extras="all"
2022-09-01T11:52:11.8234768Z �[36;1mpoetry install --no-interaction --extras="all"�[0m
2022-09-01T11:52:11.8293922Z shell: /usr/bin/bash --noprofile --norc -e -o pipefail {0}
2022-09-01T11:52:11.8294186Z env:
2022-09-01T11:52:11.8294450Z   pythonLocation: /opt/hostedtoolcache/Python/3.10.6/x64
2022-09-01T11:52:11.8294792Z   LD_LIBRARY_PATH: /opt/hostedtoolcache/Python/3.10.6/x64/lib
2022-09-01T11:52:11.8295062Z ##[endgroup]
2022-09-01T11:52:14.9732194Z Installing dependencies from lock file
2022-09-01T11:52:18.5395309Z 
2022-09-01T11:52:18.5395785Z Package operations: 0 installs, 124 updates, 0 removals
2022-09-01T11:52:18.5396018Z 
2022-09-01T11:52:18.5401800Z   • Updating pycparser (2.21 /home/runner/.cache/pypoetry/artifacts/08/b1/1b/4618699096207aa9eba9fa35118b2b6544fd1c9c2a79ea3601a3d325a0/pycparser-2.21-py2.py3-none-any.whl -> 2.21)
...
2022-09-01T11:55:24.0727156Z   • Updating types-setuptools (57.4.9 /home/runner/.cache/pypoetry/artifacts/f0/c0/72/6a980e8e2b0bed9b0c9ab28248fd8d50bbc660f4996a3ceb3e4e37a79a/types_setuptools-57.4.9-py3-none-any.whl -> 57.4.9)
2022-09-01T11:55:31.4129482Z 
2022-09-01T11:55:31.4131315Z Installing the current project: matrix-synapse (1.66.0)
2022-09-01T11:55:31.5650229Z ##[group]Run poetry env info

Looks like 3 seconds for poetry to warm up, 4 seconds to decide we need to update a bunch of packages, then 73 seconds to do all the updates which seem to be no-ops to me?

actions/setup-python now has something for caching poetry (it didn't at the time I did all this). We could give that a try instead of this action? See https://github.com/actions/setup-python/blob/main/docs/advanced-usage.md#caching-packages Though there are reports of problems e.g. actions/setup-python#494 (that one we have anticipated)

These log lines are making me suspicious TBH: Updating pycparser (2.21 /home/runner/.cache/pypoetry/artifacts/08/b1/1b/4618699096207aa9eba9fa35118b2b6544fd1c9c2a79ea3601a3d325a0/pycparser-2.21-py2.py3-none-any.whl -> 2.21)

I had an experiment on https://github.com/DMRobertson/test-poetry-caching to see if I could simplify things somehow. Don't see those suspicious lines there but I'm not 100% sure what the difference is.

We tried rerunning a develop CI run and it looked like the caching was just fine with no changes. So maybe this was a transient thing due to us mixing poetry 1.x lockfiles with poetry 1.2 runtimes? Will need to keep an eye on this.

We tried rerunning a develop CI run and it looked like the caching was just fine with no changes. So maybe this was a transient thing due to us mixing poetry 1.x lockfiles with poetry 1.2 runtimes? Will need to keep an eye on this.

Looks like the caching is working okay now on Synapse develop. Going to close this.