[WIP] Allow Black to use a different Python version than Vim #4245
+32
−10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This branch should fix #2547
It is sometimes the case that Vim was built with a different Python version than the one used by Black.
One such scenario is when the black virtualenv was created by an older version of Vim and then the system was upgraded in place.
Another scenario is when
g:black_use_virtualenv
is disabled and the manually created environment ing:black_virtualenv
uses a different Python version. Right now Ubuntu 24.04 builds Vim with Python 3.12 but the system uses Python 3.11 as default, making this scenario more likely to happen:Currently,
:BlackVersion
reports Vim's Python version instead of the one found in the virtualenv. This PR fixes that inconsistency as well.Finally, I added a few TODO comments for issues that I encountered while testing various scenarios but didn't have the time to fix in this PR.
Checklist - did you ...
CHANGES.md
if necessary?