Skip to content

Conversation

@TheJulianJES
Copy link
Contributor

Proposed change

This enables the check-latest option for the Python setup action. If a general Python version like 3.13 is specified, setup-python will make sure the latest patch version is used, even if it's not cached in the GitHub runner.

This avoids issues we had in the past where different jobs of the CI workflow used different minor Python versions, leading to cache misses and CI failure.

Note

This is essentially the same behavior as us always pinning the latest Python patch releases, except that this automatically uses the latest patch release when only x.y is specified. In most cases, it's in the GH runner cache, so the install time should be instant. However, that's not always the case. If not cached, the Python install takes about 10 to 20 seconds.

It might actually be better if we don't pin to specific patch versions anymore, as it might be more likely for the latest patch releases to be present in GH runner cache, but not some older patch version we pinned and forgot to update.

This is something we may want to update in a future PR. Both in the shared workflows and all other projects.
(And downstream projects should really stop overriding CACHE_VERSION...)

Further changes

The specific Python version is also added to the pre-commit cache key, as the pre-commit dependencies can differ depending on the Python version used.

allow-prereleases was also missing in the pre-commit step. It's unlikely that PYTHON_VERSION_DEFAULT is a pre-release Python version, but possible, so this prevents only the pre-commit step from failing in that case.

Additional information

Also see:

@TheJulianJES TheJulianJES changed the title Use check-latest for setup-python action Use check-latest for setup-python action Dec 28, 2025
@TheJulianJES TheJulianJES merged commit eb26227 into zigpy:main Dec 28, 2025
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.

1 participant