-
Notifications
You must be signed in to change notification settings - Fork 37.8k
Don't fix Python patch version #33051
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/33051. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please react with 👎 to this comment and the bot will ignore it on the next update. ConflictsNo conflicts as of last run. |
the lint CI failed |
https://cirrus-ci.com/task/4540580631412736?logs=build#L1735: [12:20:39.690] 38.29 ++ cat /.python-version
[12:20:39.690] 38.29 + env CC=clang python-build 3.10 /python_build
[12:20:39.690] 38.31 python-build: definition not found: 3.10
[12:20:39.690] ------ |
Ah I see. For some reason the linter is calling |
Then the user should reinstall the HWI dependencies, given they've changed Python version. They would have the same issue any time they update their Python, to a newer Regardless, can you solve your issue using something out of https://github.com/pyenv/pyenv?tab=readme-ov-file#understanding-python-version-selection. Us having to change our Python version selection, to accomodate the Python version selection of a different project, would seem to undermine the point of both projects using Python version management. |
It's not really a problem for me, but I noticed HWI stopped using patch versions in bitcoin-core/HWI#695 and I don't think there's a good reason for us to insist on one. Everywhere else in the project we only specify the Python minor version. And if there's ever a security issue with the patch version we picked, we probably should go and update it (which we've never done). |
Well at least one is that we don't need to add more code/"workarounds", for a problem we don't have. (#33051 (comment)) |
But why are we cloning the PyEnv repo, but then not just using |
|
It's defined here: https://github.com/pyenv/pyenv/blob/master/plugins/python-build/bin/pyenv-install Which internally calls Which it turn calls |
lgtm ACK e71990f CI: https://cirrus-ci.com/task/5023354685489152?logs=build#L1722
In theory this could increase CI non-determinism, but we are using Ubuntu as base image, so that goal is already lost. |
The PR description and commit message will need re-writing, to explain the motivation, as the current motivaiton is just user error (updating python and not reinstalling dependencies). |
If we are going to change anything here, then we might as well swap to this. Given the original motivation is unclear, and it'd be less lines of code. |
Original discussion: #26716 (comment)
It removes a few lines for the installer, but adds some for Using PyEnv directly does make it easier to use multiple Python versions, in case any of our linters would benefit from a more recent version. I updated the commit message and PR description. |
c603071
to
43b4d00
Compare
(added rationale to the first commit message) |
Using `pyenv install` avoids the need to specify a patch version, which will be dropped in the next commit. The original reason for using the lower level `python_build`, which is part of PyEnv, was that it allowed specifying CC=clang, which needs fewer resources. But `pyenv install` supports that too.
.python-version always matches the minimum supported Python version. It's main purpose is to catch accidental use of too modern syntax in scripts and functional tests. We (currently) don't specify a minimum patch version, so it's not necessary to do so here. The minor verion is enough. This also avoids requiring users to keep a potentially unsafe old patch version installed.
.python-version
always matches the minimum supported Python version.It's main purpose is to catch accidental use of too modern syntax
in scripts and functional tests.
We (currently) don't specify a minimum patch version, so it's not
necessary to do so here. The minor verion is enough.
This also avoids requiring users to keep a potentially unsafe old
patch version installed.
The linter CI job used
python_build
(part of PyEnv) which requires specifying an exact Python version. The first commit changes it to use the higher levelpyenv install
which will pick the most recent patch version it knows about.The original stated reason for using the lower level
python_build
#26716 (comment) was that it allowed specifyingCC=clang
which needs fewer resources, butpyenv install
can do that as well.See also bitcoin-core/HWI#695